-
-
Notifications
You must be signed in to change notification settings - Fork 772
Add new entrypoint option to --load-extension
#1789
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
Conversation
This looks great! You need to run |
If you cherry-pick in the fix from #1778 it should fix the Read the Docs failure. |
If you wanted to be really ambitious about documentation a page that explained what it takes to actually run SQLite extensions in Python would be great. I'm still trying to figure out the best way to do that in macOS myself. |
I don't think we should block landing this PR on that though. |
036c097
to
5a2a05f
Compare
Rebased, Read the docs failure should now now fixed Re docs - ya that's a pretty ambitious page, I'm still not 100% sure what the best practices are/should be... Would be happy to make that page in a future PR |
Any tips on how I can get the GitHub Action I imagine I need an extra step before datasette/.github/workflows/test.yml Line 31 in 663ac43
Neatest thing would be to cache the compiled file between actions runs (in the Actions cache) so we don't have to add the SQLite build dependencies on most runs. |
@simonw to build the extension on ubuntu, you can run:
I'm not the best with Actions, but if you set the cache key to |
I'm going to merge as-is and then figure out the GitHub Actions bit separately. Thanks! |
Closes #1784
The
--load-extension
flag can now accept an optional "entrypoint" value, to specify which entrypoint SQLite should load from the given extension.For testing, I added a small SQLite extension in C at
tests/ext.c
. If compiled, then pytest will run the unit tests intest_load_extensions.py
to verify that Datasette loads in extensions correctly (and loads the correct entrypoints). Compiling the extension requires a C compiler, I compiled it on my Mac with:Where
path/to/sqlite
is a directory that contains the SQLite amalgamation header files.Re documentation: I added a bit to the help text for
--load-extension
(which I believe should auto-add to documentation?), and the existing extension documentation is spatialite specific. Let me know if a new extensions documentation page would be helpful!