Skip to content
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

SQLx Next (0.7+) Tracking Issue #1163

Closed
4 of 30 tasks
mehcode opened this issue Apr 9, 2021 · 12 comments
Closed
4 of 30 tasks

SQLx Next (0.7+) Tracking Issue #1163

mehcode opened this issue Apr 9, 2021 · 12 comments

Comments

@mehcode
Copy link
Member

mehcode commented Apr 9, 2021

Things are taking longer than we'd like on this so I'm putting up a tracking issue to share some insight on what remains to be done in the next branch.

  • Type-safe macros ( query!, etc. )

  • Transactions

  • Streams (fetch)

  • Pool

       PgConnectOptions::parse("postgres://....")?
         .tls( .... )
         .pooled() // -> PgPoolOptions
         .max_connections(10)
         .connect().await? // Pool (either this or finish)
         .finish() // Pool (either this or connect) 
  • Database Errors

  • Generalized Query Placeholders [Next] [Feature] Generalized query placeholders (including support for expanding arrays into multiple placeholders) #875

    • Positional {0} becomes $n or ?n or @pn, etc.
    • Named {name} is resolved to a positional parameter so this works anywhere - not just sqlite
    • Zero or More Repetition {name+} = NULL or $1, $2, ...
    • Field Expressions in parens {(x.y.z)}
    • Implicit parameter scope
    • Explicit parameter scope with ..some_struct Struct update rest pattern syntax support for named bindings #591
  • Runtime named parameters

  • TLS

  • Any (Driver)

  • Derives

    • FromRow
    • Type
  • Query logging

  • Statement caching

  • MySQL

    • Type parity
    • Support for MySQL 5.5
    • Use Error::Client for client errors
  • PostgreSQL

    • Support for SASL (authentication)
    • Type parity
    • Listener
    • Database error
  • SQLite

The PostgreSQL and MySQL drivers are done enough to test and prod the basics if anyone has time to poke it.

@link2xt
Copy link
Contributor

link2xt commented Apr 17, 2021

Does the next branch include all the fixes from the master branch? Are fixes cherry-picked, merged or is the branch occasionally rebased? Currently it says the branch is 1850 commits behind master.

@mehcode
Copy link
Member Author

mehcode commented Apr 17, 2021

The next branch is a full rewrite of at least the core that is being developed in parallel at the moment. Postgres and MySQL are nearing feature parity with master. Once that happens we'll port the test suite and then audit the comparison to ensure we don't miss anything important. I know there will probably be some bumps but there are some good reasons for why a lot of these changes couldn't have easily been done iteratively, notably the runtimes and cancellation safety.

@gyzerok
Copy link

gyzerok commented Aug 12, 2021

@mehcode how up to date are checkboxes? Would you mind updating them?

@amitavaghosh1
Copy link

Could you guys also please look at the enum issue in mysql? where query_as! works fine but query_as() fails to do it properly. Right now we are overriding FromRow manually

@abonander abonander changed the title SQLx Next (0.6+) Tracking Issue SQLx Next (0.7+) Tracking Issue Aug 30, 2021
@nyurik
Copy link
Contributor

nyurik commented Feb 17, 2023

Would it be possible to re-release the old 0.6 as 0.7 with just the breaking libsqlite3-sys bump to 0.25.2?

All pending changes in the main would then go to 0.8 instead. It's not like numbers have much "value" in of itself, easy to increment - and minor bump would indicate the breaking nature of the change, even though it would contain just a tiny but breaking fix.

@galah92
Copy link

galah92 commented Mar 19, 2023

Would it be possible to re-release the old 0.6 as 0.7 with just the breaking libsqlite3-sys bump to 0.25.2?

+1

@lu-zero
Copy link

lu-zero commented Apr 5, 2023

If somebody volunteers time to prepare such 0.6+sqlite-fix branch could it be published once ready?

@nyurik
Copy link
Contributor

nyurik commented Apr 13, 2023

I created a new PR that just bumps the sqlite3 #2455 based on the v0.6.3 release. See the description there, as it requires a new branch in order to be merged.

@mrl5
Copy link
Contributor

mrl5 commented Jul 9, 2023

hello, I noticed that changelog doesn't mention breaking change related to sqlx prepare - namely --merged flag is no longer supported.

to reproduce

cargo install --version 0.7.0 sqlx-cli

and then run

cargo sqlx prepare --merged -D "${DB_URI}"

actual result

error: Found argument '--merged' which wasn't expected, or isn't valid in this context

	If you tried to supply `--merged` as a value rather than a flag, use `-- --merged`

USAGE:
    cargo sqlx prepare [OPTIONS] --database-url <DATABASE_URL> [-- <ARGS>...]

For more information try --help

expected result
I'm not really sure. Does it mean that with 0.7.0 I no longer need to have sqlx-data.json?

@stefankreutz
Copy link

stefankreutz commented Jul 9, 2023 via email

@mrl5
Copy link
Contributor

mrl5 commented Jul 9, 2023

unfortunately after migrating to 0.7.0 and changing --merged to --workspace here

I'm getting:

warning: no queries found

and empty .sqlx directory on top level - I've tried to audit https://github.com/launchbadge/sqlx/blob/v0.7.0/sqlx-cli/src/prepare.rs but I have no clue why it's unable to find queries :/

update

ok so I had to:

  1. bump sqlx version also in Cargo.toml - seems like sqlx-cli requires version compatibility
  2. remove offline feature:
-sqlx = { version = "^0", features = [
+sqlx = { version = "0.7.0", features = [
     "chrono",
     "macros",
     "migrate",
-    "offline",
     "postgres",

@mrl5
Copy link
Contributor

mrl5 commented Jul 12, 2023

seems like #2086 introduced breaking change also for projects that don't do custom impl of PgHasArrayType (contrary to #2086 (comment))

more info in #2611

mrl5 added a commit to mrl5/windmill that referenced this issue Jul 14, 2023
@abonander abonander closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2023
@abonander abonander unpinned this issue Jul 15, 2023
rubenfiszel added a commit to windmill-labs/windmill that referenced this issue Jul 15, 2023
* DRAFT chore(backend): upgrade sqlx to ^0.7

related to:
* #1858
* launchbadge/sqlx#1163 (comment)

* (vol. 2) in 0.7, `Transaction` can no longer implement `Executor` directly

ref: https://github.com/launchbadge/sqlx/blob/afb6b1066e61f8e3875f530d96cfb5a299f13fda/examples/postgres/transaction/src/main.rs#L14-L17

notice that I'm temporarly using my custom patch
mrl5/sqlx@16e4c9a
it's related to launchbadge/sqlx#2611

* post git rebase chores

* use upstream fix from 0.7.1

* fix compile

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants