mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Add new entrypoint option to --load-extensions. (#1789)
Thanks, @asg017
This commit is contained in:
parent
663ac431fe
commit
1d64c9a8da
6 changed files with 140 additions and 2 deletions
|
|
@ -559,7 +559,13 @@ class Datasette:
|
|||
if self.sqlite_extensions:
|
||||
conn.enable_load_extension(True)
|
||||
for extension in self.sqlite_extensions:
|
||||
conn.execute("SELECT load_extension(?)", [extension])
|
||||
# "extension" is either a string path to the extension
|
||||
# or a 2-item tuple that specifies which entrypoint to load.
|
||||
if isinstance(extension, tuple):
|
||||
path, entrypoint = extension
|
||||
conn.execute("SELECT load_extension(?, ?)", [path, entrypoint])
|
||||
else:
|
||||
conn.execute("SELECT load_extension(?)", [extension])
|
||||
if self.setting("cache_size_kb"):
|
||||
conn.execute(f"PRAGMA cache_size=-{self.setting('cache_size_kb')}")
|
||||
# pylint: disable=no-member
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue