mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-25 02:14: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
|
|
@ -1,4 +1,5 @@
|
|||
import base64
|
||||
import os
|
||||
|
||||
try:
|
||||
import pysqlite3 as sqlite3
|
||||
|
|
@ -10,6 +11,11 @@ except ImportError:
|
|||
|
||||
OperationalError = sqlite3.OperationalError
|
||||
|
||||
SPATIALITE_PATHS = (
|
||||
"/usr/lib/x86_64-linux-gnu/mod_spatialite.so",
|
||||
"/usr/local/lib/mod_spatialite.dylib",
|
||||
)
|
||||
|
||||
|
||||
def suggest_column_types(records):
|
||||
all_column_types = {}
|
||||
|
|
@ -74,3 +80,10 @@ def decode_base64_values(doc):
|
|||
if not to_fix:
|
||||
return doc
|
||||
return dict(doc, **{k: base64.b64decode(doc[k]["encoded"]) for k in to_fix})
|
||||
|
||||
|
||||
def find_spatialite():
|
||||
for path in SPATIALITE_PATHS:
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue