Closed darrenwiens closed 11 months ago
A slightly more elegant solution would be this:
spatial_extension_query = conn.execute("SELECT * FROM duckdb_extensions() WHERE installed IS TRUE AND extension_name = 'spatial';").fetchone()
if spatial_extension_query is None:
conn.execute("INSTALL spatial;")
conn.execute("LOAD spatial;")
I haven't checked but I imagine duckdb.duckdb.IOException
can also indicate failure that isn't caused by the issue that we're facing here, so explicitly checking whether the extension is installed is better than try-except.
@felix-schott Sure, that works for me. Thanks!
Resolves #38
In this PR, we attempt to load the
spatial
duckdb extension. If it fails to load because it has not been installed, install it, then load the extension.