sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

SQLite extension loading via sqlx.toml for CLI and query macros

Open djarb opened this issue 1 year ago • 6 comments

fixes issue #3330 by allowing the query checking macros to load SQLite extensions specified in sqlx.toml.

Related to that, also allows the CLI to load the SQLite extensions specified in sqlx.toml when running migrations

djarb avatar Jan 29 '25 15:01 djarb

(I'm just now realizing the build failures are from #3383 itself so disregard that.)

abonander avatar Jan 31 '25 00:01 abonander

I'll be happy to add an example, but there's a complication: to demonstrate this functionality, it's necessary to load a SQLite extension, and that requires that the example is dependent on having that extension installed. Are you okay with having an example that has a third-party dependency which is not shipped with SQLx? If so, what is your preference for how I structure that?

djarb avatar Jan 31 '25 12:01 djarb

Our CI already downloads an extension from https://github.com/nalgeon/sqlean/ for testing: https://github.com/launchbadge/sqlx/blob/65229f7ff91ecd38be7c10fb61ff3e05bedabe87/.github/workflows/sqlx.yml#L125

One thing is that for Unix platforms, you need to show the user either how to set LD_LIBRARY_PATH or to specify a relative path to the extension.

abonander avatar Feb 02 '25 00:02 abonander

Is there anything further that you need from me to get this merged?

djarb avatar Feb 12 '25 12:02 djarb

Hello? Just checking in. I'd really appreciate it if this could be merged, or if you could let me know what I need to do to get it to that point.

djarb avatar Mar 28 '25 12:03 djarb

  • Updated the pull request to apply to the current version of the branch.
  • The requested example is in place. It has been for months, but I just realized I never explicitly said so.
  • To run the example use ./x.py -p sqlite/extension in the examples/ directory.
  • A couple of minor, unrelated bug fixes that were necessary in order to be able to run cargo check and the example with the current sqlx-toml version

djarb avatar Jun 02 '25 20:06 djarb

@djarb this got closed because I merged and deleted the sqlx-toml branch. Please rebase against main and open a new PR.

abonander avatar Jun 30 '25 23:06 abonander