sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Feature Request: Support DuckDB in SQLx

Open DeflateAwning opened this issue 1 year ago • 9 comments

Is your feature request related to a problem? Please describe. I wish I could use DuckDB in SQLx. SQLite is too slow for many of my applications, whereas DuckDB is exactly what I need.

Describe the solution you'd like I'd like DuckDB support which parallels SQLite.

Describe alternatives you've considered SQLite is an alternative. The official DuckDB bindings for Rust are totally good and usable, but being able to have compile-time SQL checks, and integration with the ORM layers on top of sqlx would be awesome!

Additional context DuckDB is an interesting database that is quite similar to SQLite (in-process execution, single-file databases, light weight, single-executable). Their client crate offers an API very similar to that of rusqlite. As an OLAP database, it is very fast, and very good for data analytics, an area which Rust is making large strides in (esp. with the development of Polars).

DeflateAwning avatar Apr 09 '24 01:04 DeflateAwning

See the following comment for our general disposition on adding drivers: https://github.com/launchbadge/sqlx/issues/3115#issuecomment-2002636940

See also #1999

abonander avatar Apr 09 '24 01:04 abonander

#1999 is closed, so I opened a new issue to track this active request. Hopefully more people will get in here to vote for this one, as I think it has huge potential!

DeflateAwning avatar Apr 09 '24 01:04 DeflateAwning

I would also be interested in this! For users who want to use embedded databases, from what I've read, DuckDB is the go-to embedded OLAP database. It doesn't fill the same role as SQLite. And sqlx doesn't support any competing embedded OLAP database products.

JohnstonJ avatar Sep 26 '24 08:09 JohnstonJ

The way SQLx is designed now, a DuckDB driver would not strictly need to be merged into this repo to be usable.

There's some roughness around the macros and sqlx-cli that I have plans to address in future releases.

abonander avatar Sep 28 '24 03:09 abonander