Hi,

I searched both mailing lists but didn't find any reference to the
following, hence my post.

I have written an application that starts a new thread, and as this
thread is executing I want to save data to the database.  This worked
when I used postgreSQL, but it failed when I used SQLite.  The error
message was:

ProgrammingError: SQLite objects created in a thread can only be used
in that same  thread.

I discovered this was a feature of pysqlite[1] and that it could be
controlled by a parameter that is passed  to the connection_init
method.

I changed the following line in django.core.db.bankends.sqlite3.py
from:
  self.connection = Database.connect(DATABASE_NAME,
detect_types=Database.PARSE_DECLTYPES)
to:
  self.connection = Database.connect(DATABASE_NAME,
detect_types=Database.PARSE_DECLTYPES, check_same_thread=0)

and then validated my application worked.

I guess this could be added as a variable in settings.py to avoid me
editing django source for my applications.  It could have a default
value of 1, this would leave the current mode of operation untouched.

What do people think?
-John K

[1] http://tinyurl.com/syud4


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to