|
async def check_databases(ds): |
|
# Run check_connection against every connected database |
|
# to confirm they are all usable |
|
for database in list(ds.databases.values()): |
|
try: |
|
await database.execute_fn(check_connection) |
|
except SpatialiteConnectionProblem: |
|
raise click.UsageError( |
|
"It looks like you're trying to load a SpatiaLite" |
|
" database without first loading the SpatiaLite module." |
|
"\n\nRead more: https://docs.datasette.io/en/stable/spatialite.html" |
|
) |
|
except ConnectionProblem as e: |
|
raise click.UsageError( |
|
f"Connection to {database.path} failed check: {str(e.args[0])}" |
|
) |
This could use the find_spatialite() function and, if it finds something, suggest the user use --load-extension=spatialite
|
def find_spatialite(): |
|
for path in SPATIALITE_PATHS: |
|
if os.path.exists(path): |
|
return path |
|
raise SpatialiteNotFound |
datasette/datasette/cli.py
Lines 533 to 548 in 242bc89
This could use the
find_spatialite()function and, if it finds something, suggest the user use--load-extension=spatialitedatasette/datasette/utils/__init__.py
Lines 1015 to 1019 in 242bc89