From a3639f39d9b27000b2bcf756faba7c97f5ceebac Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Thu, 3 Feb 2022 14:27:21 -0500 Subject: [PATCH] Import find_spatialite into utils for backwards compat --- sqlite_utils/gis.py | 7 +++---- sqlite_utils/utils.py | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sqlite_utils/gis.py b/sqlite_utils/gis.py index 6850bc5..762c884 100644 --- a/sqlite_utils/gis.py +++ b/sqlite_utils/gis.py @@ -1,5 +1,4 @@ import os -from .db import Database, Table SPATIALITE_PATHS = ( "/usr/lib/x86_64-linux-gnu/mod_spatialite.so", @@ -30,7 +29,7 @@ def find_spatialite() -> str: return None -def init_spatialite(db: Database, path: str) -> bool: +def init_spatialite(db, path: str) -> bool: """ The ``init_spatialite`` function will load and initialize the Spatialite extension. The ``path`` argument should be an absolute path to the compiled extension, which @@ -67,7 +66,7 @@ def init_spatialite(db: Database, path: str) -> bool: def add_geometry_column( - table: Table, + table, geometry_type: str, column_name: str = "geometry", srid: int = 4326, @@ -106,7 +105,7 @@ def add_geometry_column( return result and bool(result[0]) -def create_spatial_index(table: Table, column_name: str = "geometry") -> bool: +def create_spatial_index(table, column_name: str = "geometry") -> bool: """ A spatial index allows for significantly faster bounding box queries. To create on, use ``create_spatial_index`` with a :ref:`table ` diff --git a/sqlite_utils/utils.py b/sqlite_utils/utils.py index df5b439..6fdc04f 100644 --- a/sqlite_utils/utils.py +++ b/sqlite_utils/utils.py @@ -22,6 +22,9 @@ except ImportError: OperationalError = sqlite3.OperationalError +# backwards compatibility +from .gis import find_spatialite + def suggest_column_types(records): all_column_types = {}