Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed inspectdb test for spatialite >=4

  • Loading branch information...
commit 4c5641dd92e5cfa0223f417f30d109ff998b8041 1 parent c82f6c2
@claudep claudep authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 django/contrib/gis/db/backends/spatialite/introspection.py
View
7 django/contrib/gis/db/backends/spatialite/introspection.py
@@ -25,9 +25,10 @@ def get_geometry_type(self, table_name, geo_col):
cursor = self.connection.cursor()
try:
# Querying the `geometry_columns` table to get additional metadata.
- cursor.execute('SELECT "coord_dimension", "srid", "type" '
- 'FROM "geometry_columns" '
- 'WHERE "f_table_name"=%s AND "f_geometry_column"=%s',
+ type_col = 'type' if self.connection.ops.spatial_version < (4, 0, 0) else 'geometry_type'
+ cursor.execute('SELECT coord_dimension, srid, %s '
+ 'FROM geometry_columns '
+ 'WHERE f_table_name=%%s AND f_geometry_column=%%s' % type_col,
(table_name, geo_col))
row = cursor.fetchone()
if not row:
Please sign in to comment.
Something went wrong with that request. Please try again.