Skip to content

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

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

Closed
wants to merge 79 commits into from

Conversation

djarb
Copy link
Contributor

@djarb djarb commented Jan 29, 2025

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

abonander and others added 19 commits January 6, 2025 16:14
simplifies usage while still making parsing optional for less generated code
# Conflicts:
#	Cargo.lock
Copy link
Collaborator

@abonander abonander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very keen in landing this, but besides fixing the build, it does also need some sort of test to prove that it works, and ideally a compile-checked example that shows how to use it. In #3383 I realized I could take out two birds with one stone by adding some example projects showing off the new configuration. I'd suggest doing the same.

@abonander
Copy link
Collaborator

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

@djarb
Copy link
Contributor Author

djarb commented Jan 31, 2025

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?

@abonander
Copy link
Collaborator

Our CI already downloads an extension from https://github.com/nalgeon/sqlean/ for testing:

- run: mkdir /tmp/sqlite3-lib && wget -O /tmp/sqlite3-lib/ipaddr.so https://github.com/nalgeon/sqlean/releases/download/0.15.2/ipaddr.so

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.

djarb added 2 commits February 3, 2025 03:03
…SQLite extensions
@djarb djarb requested a review from abonander February 3, 2025 11:06
@djarb
Copy link
Contributor Author

djarb commented Feb 12, 2025

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

@djarb
Copy link
Contributor Author

djarb commented Mar 28, 2025

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.

abonander and others added 9 commits June 1, 2025 23:28
…g used and causing a compile error
@djarb
Copy link
Contributor Author

djarb commented Jun 2, 2025

  • 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

@abonander abonander force-pushed the sqlx-toml branch 6 times, most recently from f46f747 to 60cacd7 Compare June 4, 2025 23:02
@abonander abonander force-pushed the sqlx-toml branch 2 times, most recently from b6b09f3 to 243d810 Compare June 30, 2025 23:19
@abonander abonander deleted the branch launchbadge:sqlx-toml June 30, 2025 23:34
@abonander abonander closed this Jun 30, 2025
@abonander
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants