-
Notifications
You must be signed in to change notification settings - Fork 54
feat: enable load_extensions config for connections #247
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
feat: enable load_extensions config for connections #247
Conversation
This does introduce loading extensions globally for anyone using multiple ecto sqlite databases. While I think 90+% of use cases just have one DB, I think there will be others out there that need different extensions loaded for different repos. This is contrived but I was thinking something like: config :my_app, MyApp.FooRepo,
database: "foo.db",
load_extensions: [
"./priv/sqlite/darwin-arm64/lines0"
]
config :my_app, MyApp.BarRepo,
database: "bar.db",
load_extensions: [
"./priv/sqlite/darwin-arm64/vector0",
"./priv/sqlite/darwin-arm64/vss0"
] Having it at the global level for |
Great suggestion. I've gone ahead and updated to support a combined global and per-connection options loading. Let me know if you have any codebase style preferences |
96b45d2
to
278bb02
Compare
Perfect! |
@bkono would you mind adding some documentation to the |
278bb02
to
60837f8
Compare
Of course. In my apps I've been using a little helper for architecture resolution (since I'm on macOS & linux for dev & deploy). Wasn't sure if there's a good place to suggest something like this. I'll probably just create a light sample repo to point people at, but adding it here in case you have an alternative:
|
I think that is a totally reasonable example to provide. Others may do their resolutions differently. |
60837f8
to
c7b40a3
Compare
Done and updated. Let me know if there's anything else missing. |
Opening this to start a discussion. This is an attempt to implement this comment from issue #136, piggybacking on the hard work done in #160.
I needed this to be able to actively use extensions with Ecto inside a Phoenix app. There's a few scenarios where it comes in handy, but the primary driver for me is an app doing vector queries via sqlite-vss which needs both vector0 and vss0 libs loaded on the connection.
With this change, adding the below in a phoenix app makes everything Just Work™:
If there's interest in this, I'm happy to clean up the PR (coughIO.puts...cough) and update with documentation as well, but didn't want to invest too much time without confirming it's a change you want to take upstream.