#35163: sqlite3.OperationalError: no such column: django_migrations.id
-------------------------------------+-------------------------------------
     Reporter:  milahu               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |  worksforme
     Keywords:  sqlite               |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by milahu):

 the "id" columns are missing in the "CREATE TABLE" queries, but later
 appear in "INSERT INTO" queries

 currently im trying to trace the "CREATE TABLE" queries, but these queries
 are not passed through

 django/db/backends/sqlite3/base.py

 {{{
 class SQLiteCursorWrapper(Database.Cursor):
     def executescript(self, query):
         print(f"django/db/backends/sqlite3/base.py executescript
 query={repr(query)}")
         return super().executescript(query)
     def execute(self, query, params=None):
         # ...
         print(f"django/db/backends/sqlite3/base.py execute
 query={repr(query)} params={repr(params)}")
         return super().execute(query, params)
     def executemany(self, query, param_list):
         # ...
         print(f"django/db/backends/sqlite3/base.py executemany
 query={repr(query)} param_list={repr(param_list)}")
         return super().executemany(query, param_list)
 }}}

 the first query i see is

 {{{
 CREATE UNIQUE INDEX "django_content_type_app_label_model_76bd3d3b_uniq" ON
 "django_content_type" ("app_label", "model")
 }}}

 but before that query i already have the schema

 {{{
 CREATE TABLE "django_migrations" ("id" integer NOT NULL PRIMARY KEY
 AUTOINCREMENT, "app" varchar(255) NOT NULL, "name" varchar(255) NOT NULL,
 "applied" da
 tetime NOT NULL)
 CREATE TABLE sqlite_sequence(name,seq)
 CREATE TABLE "django_content_type" ("id" integer NOT NULL PRIMARY KEY
 AUTOINCREMENT, "name" varchar(100) NOT NULL, "app_label" varchar(100) NOT
 NULL, "mod
 }}}

 as reported by

 {{{
         if True:
             print("schema:")
             for name, sql in super().execute("SELECT name, sql FROM
 sqlite_schema"):
                 for line in sql.split("\n"):
                     print("  " + line)
 }}}

 ideas...?

 im using the sqlite backend

 i would expect that all queries are passed through SQLiteCursorWrapper
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35163#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d736842a3-2d4ecade-1b0d-4bf1-adfa-591c3e02fa9c-000000%40eu-central-1.amazonses.com.

Reply via email to