Fixed #28654 -- Dropped support for SpatiaLite 4.0.

This commit is contained in:
Tim Graham 2017-09-30 14:13:18 -04:00 committed by GitHub
parent dd82f33271
commit fd866c25d1
7 changed files with 13 additions and 18 deletions

View File

@ -61,5 +61,4 @@ class DatabaseWrapper(SQLiteDatabaseWrapper):
with self.cursor() as cursor:
cursor.execute("PRAGMA table_info(geometry_columns);")
if cursor.fetchall() == []:
arg = "1" if self.features.supports_initspatialmetadata_in_one_transaction else ""
cursor.execute("SELECT InitSpatialMetaData(%s)" % arg)
cursor.execute("SELECT InitSpatialMetaData(1)")

View File

@ -8,13 +8,6 @@ from django.utils.functional import cached_property
class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures):
supports_3d_storage = True
@cached_property
def supports_initspatialmetadata_in_one_transaction(self):
# SpatiaLite 4.1+ support initializing all metadata in one transaction
# which can result in a significant performance improvement when
# creating the database.
return self.connection.ops.spatial_version >= (4, 1, 0)
@cached_property
def supports_area_geodetic(self):
return bool(self.connection.ops.lwgeom_version())

View File

@ -41,9 +41,9 @@ class SpatiaLiteIntrospection(DatabaseIntrospection):
# from OGC geom type name to Django field.
ogr_type = row[2]
if isinstance(ogr_type, int) and ogr_type > 1000:
# SpatiaLite versions >= 4 use the new SFSQL 1.2 offsets
# 1000 (Z), 2000 (M), and 3000 (ZM) to indicate the presence of
# higher dimensional coordinates (M not yet supported by Django).
# SpatiaLite uses SFSQL 1.2 offsets 1000 (Z), 2000 (M), and
# 3000 (ZM) to indicate the presence of higher dimensional
# coordinates (M not yet supported by Django).
ogr_type = ogr_type % 1000 + OGRGeomType.wkb25bit
field_type = OGRGeomType(ogr_type).django

View File

@ -1,6 +1,5 @@
"""
SQL functions reference lists:
https://web.archive.org/web/20130407175746/https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.0.0.html
https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html
"""
from django.contrib.gis.db.backends.base.operations import (
@ -96,8 +95,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
self.connection.settings_dict['NAME'],
)
) from exc
if version < (4, 0, 0):
raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 4.0.0 and above.')
if version < (4, 1, 0):
raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 4.1.0 and above.')
return version
def convert_extent(self, box):

View File

@ -13,7 +13,7 @@ Program Description Required
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.2, 2.1, 2.0, 1.11, 1.10, 1.9
:doc:`GeoIP <../geoip2>` IP-based geolocation library No 2
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.3, 2.2, 2.1
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3, 4.2, 4.1, 4.0
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3, 4.2, 4.1
======================== ==================================== ================================ ===================================
Note that older or more recent versions of these libraries *may* also work
@ -32,7 +32,6 @@ totally fine with GeoDjango. Your mileage may vary.
PostGIS 2.1.0 2013-08-17
PostGIS 2.2.0 2015-10-17
PostGIS 2.3.0 2016-09-26
SpatiaLite 4.0.0 2012-11-25
SpatiaLite 4.1.0 2013-06-04
SpatiaLite 4.2.0 2014-07-25
SpatiaLite 4.3.0 2015-09-07

View File

@ -61,7 +61,7 @@ Database Library Requirements Supported Versions Notes
PostgreSQL GEOS, GDAL, PROJ.4, PostGIS 9.4+ Requires PostGIS.
MySQL GEOS, GDAL 5.6+ Not OGC-compliant; :ref:`limited functionality <mysql-spatial-limitations>`.
Oracle GEOS, GDAL 12.1+ XE not supported.
SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.6.+ Requires SpatiaLite 4.0+
SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.6.+ Requires SpatiaLite 4.1+
================== ============================== ================== =========================================
See also `this comparison matrix`__ on the OSGeo Wiki for

View File

@ -200,6 +200,11 @@ Database backend API
* ...
:mod:`django.contrib.gis`
-------------------------
* Support for SpatiaLite 4.0 is removed.
Dropped support for MySQL 5.5
-----------------------------