refinery icon indicating copy to clipboard operation
refinery copied to clipboard

Add refinery driver for libsql.

Open ignatz opened this issue 1 year ago • 4 comments

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 avatar Jun 06 '24 11:06 ignatz

FWIW, I did see https://github.com/rust-db/refinery/pull/295#issuecomment-1838429822. 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

ignatz avatar Jun 06 '24 11:06 ignatz

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?

jxs avatar Jun 08 '24 00:06 jxs

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.

ignatz avatar Jun 08 '24 08:06 ignatz

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.

oscartbeaumont avatar Jul 04 '24 11:07 oscartbeaumont