sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Ability to configure SQLite extension entrypoint in `sqlx.toml`

Open supleed2 opened this issue 2 months ago • 2 comments

I have found these related issues/pull requests

Related to #3928 and the original addition in #3917

Description

I'm trying out the SQLite extension support using the 0.9.0-alpha.1 versions of sqlx and sqlx-cli.

I was previously getting errors about the config file sqlx.toml not parsing correctly. The config key was changed in #3928 but the example wasn't updated to match.

Current example:

[common.drivers.sqlite]
unsafe-load-extensions = ["/tmp/sqlite3-lib/ipaddr"]

But the section was updated to be:

[drivers.sqlite]
unsafe-load-extensions = ["/tmp/sqlite3-lib/ipaddr"]

After getting the extension loading working, the sqlx::query! and sqlx::query_as! macros would panic. Renaming the extension file to match the * in sqlite_*_init worked.

Could the sqlx.toml format expose an equivalent to extension_with_entrypoint as an option?

Prefered solution

  • Update the example at examples/sqlite/extension/sqlx.toml to match the actual format
  • Allow an array of strings and objects under drivers.sqlite.unsafe-load-extensions, possible example:
[drivers.sqlite]
unsafe-load-extensions = [
    "/tmp/sqlite3-lib/ipaddr",
    { path = "/tmp/sqlite3-lib/ipaddr_renamed", entrypoint = "sqlite_ipaddr_init" }
]

Is this a breaking change? Why or why not?

I don't believe so, since the sqlx.toml format could still accept just a string in each entry of drivers.sqlite.unsafe-load-extensions to mean "use the default entrypoint based on the filename".

supleed2 avatar Nov 09 '25 17:11 supleed2

Hey can I work on the issue if yes please assign it to me!

sahbaazansari avatar Nov 10 '25 00:11 sahbaazansari

@sahbaazansari just go ahead and open a PR when you have something for me to look at.

abonander avatar Nov 10 '25 05:11 abonander