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

Add refinery driver for libsql. #337

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add refinery driver for libsql. #337

wants to merge 2 commits into from

Conversation

ignatz
Copy link

@ignatz ignatz commented Jun 6, 2024

Disclaimer: I'm not overly familiar with the code base, so I'll quickly share my approach:

  • Adapted the tokio-postgres implementation for AsyncMigrate
  • Adapted the sqlite tests from rusqlite:
  • Made tests async
  • And removed all tests for run_iter().

Disclaimer: I'm not overly familiar with the code base, so I'll quickly
share my approach:

 * Adapted the tokio-postgres implementation for AsyncMigrate
 * Adapted the sqlite tests from rusqlite:
  * Made tests async
  * And removed all tests for run_iter().
@ignatz
Copy link
Author

ignatz commented Jun 6, 2024

FWIW, I did see #295 (comment). However, it's not clear to me how I would provide an AsyncMigrate implementation satisfying Rust's no-orphan rule. Could you provide a bit more context or point to an example? Thanks

@jxs
Copy link
Member

jxs commented Jun 8, 2024

Hi, and thanks for your interest! what If you wrap the libsql connection type in a new type? Btw, can't a rusqlite connection connect to a libsql database?

@ignatz
Copy link
Author

ignatz commented Jun 8, 2024

what If you wrap the libsql connection type in a new type?

Wrapping the connection into an adapter would work to work around the orphan rule (sorry for being pedantic, i don't think that's what the new type idiom intends)

Btw, can't a rusqlite connection connect to a libsql database?

It can. At rest they should be compatible (Turso promises for ever but that's sort of a long time). In that sense you could open your db in rusqlite,do the migration, close it, and then open it in libsql to get the extended runtime capabilities.

I don't have a very strong argument against this flip-flop approach that goes beyond extra dependencies and esthetics.

@oscartbeaumont
Copy link
Contributor

oscartbeaumont commented Jul 4, 2024

Btw, can't a rusqlite connection connect to a libsql database?

libsql technically allows for fully remote database so if you were to do that rustqlite could not be used as to the best of my knowledge a local file is not created.

Eg.

let db = Builder::new_remote(url, auth_token).build().await

I don't have a usecase for this personally but thought it was worth mentioning. I think this is for serverless environments like AWS Lambda.

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

4 participants