#32935: Test suite fails with sqlite 3.36 and spatialite 5.
-----------------------------+--------------------------------------
Reporter: David Smith | Owner: nobody
Type: Bug | Status: closed
Component: GIS | Version: 3.2
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Comment (by Alex Tomkins):
Replying to [comment:8 S. Andrew Sheppard]:
> That said, it is fair to argue that initializing a database with Django
and spatialite 5.0 should result in a full 5.0-compatible schema.
Fortunately, it appears that the CreateMissingSystemTables method also
described in that documentation does not break, so it could be used as
part of the fallback. Perhaps something like this would be appropriate:
Just upgraded a project to Django 4.2, and this doesn't work for me -
running `CreateMissingSystemTables(1)` results in the same problem:
{{{
django.db.utils.OperationalError: error in trigger
ISO_metadata_reference_row_id_value_insert: no such column: rowid
}}}
The two workarounds which don't result in errors, your one liner in an
earlier post:
{{{
./manage.py shell -c "import
django;django.db.connection.cursor().execute('SELECT
InitSpatialMetaData(1);')";
}}}
Or a custom DatabaseWrapper which extends from the spatialite version:
{{{
from django.contrib.gis.db.backends.spatialite import base
class DatabaseWrapper(base.DatabaseWrapper):
def prepare_database(self):
# Workaround for https://code.djangoproject.com/ticket/32935
with self.cursor() as cursor:
cursor.execute("PRAGMA table_info(geometry_columns);")
if cursor.fetchall() == []:
cursor.execute("SELECT InitSpatialMetaData(1)")
super().prepare_database()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32935#comment:11>
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/01070188cb1c87f2-aab54ee3-688b-4dfe-8a9d-1a1da90ebd75-000000%40eu-central-1.amazonses.com.