-
-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include "entrypoint" option on --load-extension
?
#1784
Comments
I didn't know SQLite could do this. I agree with you - I like the I'd like to stick with |
Do you want to write a PR for this? Ideally I'd want this to be covered by a test, but it looks like So maybe a test which uses But we'd also need to bundle a compiled SQLite extension to use in the test, which would be a slightly weird thing to have in the repo. We do have one previous example of something like that though: https://github.com/simonw/datasette/blob/main/tests/spatialite.db and the script that builds it https://github.com/simonw/datasette/blob/main/tests/build_small_spatialite_db.py |
Problem
SQLite extensions have the option to define multiple "entrypoints" in each loadable extension. For example, the upcoming version of
sqlite-lines
will have 2 entrypoints: the defaultsqlite3_lines_init
(which SQLite will automatically guess for) andsqlite3_lines_noread_init
. Thesqlite3_lines_noread_init
version omits functions that read from the filesystem, which is necessary for security purposes when running untrusted SQL (which Datasette does).(Similar multiple entrypoints will also be added for sqlite-http).
The
--load-extension
flag, however, doesn't give the option to specify a different entrypoint, so the default one is always used.Proposal
I want there to be a new command line option of the
--load-extension
flag to specify a custom entrypoint like so:Then, under the hood, this line of code:
datasette/datasette/app.py
Line 562 in 7af67b5
Would look something like this:
One potential problem: For backward compatibility, I'm not sure if Click allows cli flags to have variable number of options ("arity"). So I guess it could also use a
:
delimiter like--static
:Or maybe even a new flag name?
Personally I prefer the
:
option... and maybe even--load-extension
->--load
? Definitely out of scope for this issue thoThe text was updated successfully, but these errors were encountered: