#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 S. Andrew Sheppard):
Yes, InitSpatialMetaDataFull would remain as the preferred option. The
fallback would be only for systems like Ubuntu 22.04 where using
InitSpatialMetaDataFull per the docs is not an option, because the
implementation in spatialite 5.0.1 (the latest released version) is
incompatible with sqlite 3.36 (and newer versions). In spite of the stern
warning on the PROJ.6 page, other parts of the documentation explain that
InitSpatialMetaDataFull and InitSpatialMetaData are highly compatible:
https://www.gaia-gis.it/fossil/libspatialite/wiki?name=Upgrading+existing
+DB-files+to+5.0.0
Basically, it seems that the 5.0 schema created by InitSpatialMetaDataFull
is the same as the 4.0 schema created by InitSpatialMetaData, but with
additional tables needed to support librasterlite2. Many GeoDjango users
will probably be fine without raster support, so falling back to
InitSpatialMetaData seems like it should be reasonable for most cases.
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:
{{{
cursor.execute("PRAGMA table_info(geometry_columns);")
if cursor.fetchall() == []:
if self.ops.spatial_version < (5,):
cursor.execute("SELECT InitSpatialMetaData(1)")
else:
try:
cursor.execute("SELECT
InitSpatialMetaDataFull(1)")
except OperationalError as e:
if "ISO_metadata_reference_row_id_value_insert" in
e.args[0]:
# Workaround for sqlite 3.36 and spatialite
5.0.1
cursor.execute("SELECT InitSpatialMetaData(1)")
cursor.execute("SELECT
CreateMissingSystemTables(1)")
else:
raise
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32935#comment:8>
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/010701849a42e763-a0622498-c097-48e8-952b-f49279052c79-000000%40eu-central-1.amazonses.com.