mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
find_spatialite() utility function, closes #135
This commit is contained in:
parent
c8d7969192
commit
bf4c6b7c82
3 changed files with 38 additions and 0 deletions
|
|
@ -1298,3 +1298,23 @@ For example:
|
|||
# [age] INTEGER,
|
||||
# [thumbnail] BLOB
|
||||
# )
|
||||
|
||||
.. _find_spatialite:
|
||||
|
||||
Finding SpatiaLite
|
||||
==================
|
||||
|
||||
The ``find_spatialite()`` function searches for the `SpatiaLite <https://www.gaia-gis.it/fossil/libspatialite/index>`__ SQLite extension in some common places. It returns a string path to the location, or ``None`` if SpatiaLite was not found.
|
||||
|
||||
You can use it in code like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from sqlite_utils import Database
|
||||
from sqlite_utils.utils import find_spatialite
|
||||
|
||||
db = Database("mydb.db")
|
||||
spatialite = find_spatialite()
|
||||
if spatialite:
|
||||
db.conn.enable_load_extension(True)
|
||||
db.conn.load_extension(spatialite)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue