By everything I read in the docs, both Django and py-sqlite3 should be fine with threaded access. (Right?) But the attached code snippet fails for me. The operations in the main thread work, but not in the thread(s) I create. There I get:
File "C:\Python27\lib\site-packages\django-1.9-py2.7.egg\django\db\backends\sq lite3\base.py", line 323, in execute return Database.Cursor.execute(self, query, params)
OperationalError: no such table: thrtest_mymodel
What's the problem?
How do I go about tracking down exactly what's happening? The point of failure in Django is pretty indimidating. I can't tell how to see what tables it DOES see, or what differences to look for between main and other threads.
Here is DATABASES from settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:', # os.path.join(BASE_DIR, 'db.sqlite3'),
'TEST_NAME' : ':memory:',
},
}With respect to Django's ticket #12118, I get the same symptoms using ':memory:' or a disk file (for TEST_NAME).
Django 1.9, Python 2.7.11.
Posted yesterday on stackoverflow.