Hello everyone,
I’d like to introduce you to sqlx-exasol, a Rust connector to the Exasol database that relies on the foundation of SQLx, one of the most popular database frameworks in the Rust ecosystem.
I’ve been working on, maintaining and improving the driver for about two and a half years now and I just released v0.9.2, which finally brings feature parity with the Postgres, MySQL and SQLite drivers that come bundled in sqlx, with the last remaining milestone being compile-time checked queries.
Apart from the inherited capabilities of sqlx, sqlx-exasol allows binding arrays of parameters as query arguments (both in runtime and compile-time checked queries), has support for specifying additional host ranges through ExaConnectOptionsBuilder::extra_host and provides ETL capabilities for performant IMPORT/EXPORT not unlike PyExasol, but in a simpler to use, flexible and asynchronous fashion.
The driver is fairly well tested and the documentation should be sufficient to get you started. However, you should also go through the sqlx documentation itself, since that will give you a much better idea of how a driver operates within the framework.
I’ll take this opportunity to also mention that I’m looking for help in maintaining the project. My work didn’t have much to do with databases lately and thus updates to sqlx or Exasol itself are usually reflected with a certain delay in the driver.
Down the line I’d be more than willing to take on co-maintainers or even transfer ownership to a community that will passionately continue the development.
For the time being, I hope you find it useful and I’m looking forward to hearing your feedback! And of course, feel free to open issues if you’re having any trouble
!
2 Likes
I’ll also add some minor observations to hopefully clarify some things.
-
I apparently forgot to remove the documented limitation that sqlx-exasol and sqlx cannot be used within the same crate when macros are involved. This is a left-over from over the summer when I found a way to introduce compile-time query checking and only these days did I also find a way to circumvent the limitation. This would unfortunately warrant a new release and I’d appreciate more feedback before I get to do that.
-
Talking about releases, the versioning itself may seem a little odd. sqlx-exasol v0.9.2 depends on sqlx v0.9.0-alpha.1. I did not want to wait until the non-alpha release because I’ve been eager to get this out there and I needed the latest version because it contains some contributions of mine to sqlx to allow compile-time query checking in sqlx-exasol. So you may wonder, why not v0.9.0? Well, that was the plan but a bug surfaced in the ETL refactor done recently that was very situational and the CI or my local tests could not even reproduce. The bug caused IMPORT ETL jobs to never finish when under a VPN connection on MacOS, or so it was reported by a user. As a result v0.9.1 was released to address that, and I literally noticed that the https://docs.rs build was failing when I wanted to post this. As a result, I went back and tweaked some more things and released v0.9.2 .
While it would be nice to have sqlx-exasol and sqlx versions in sync and traditionally that was the case (sqlx-exasol would previously need to be used through sqlx where as now it re-exports all the required internals), the two are now entirely disjoint and can evolve on their own.
I hope this does not cause too much confusion
!
Thanks for sharing, exciting to see which integrations the community builds around Exasol. My colleague @Marco_Nätlitz built a Rust driver that he will share in the community shortly. Interesting to see advantages of both solutions.
@florian_wenzel It’s great to see interest!
Perhaps also worth mentioning are the features that sqlx-exasol provides. Since it’s built on top of sqlx, it inherits:
- connection pooling
- migrations support (including reversible migrations)
- testing support (automatic creation & deletion of test schemas)
- fixtures (mainly for testing purposes)
- transaction management
- prepared statements caching
- battle-tested query interfaces and parameter bindings familiar to the Rust community
- compile-time query checking (SQL and paramter/return type correctness)
- user defined types for business logic
- common API with other SQLx drivers such as PostgreSQL, MySQL or SQLite, making it easy to learn or switch between
On top of this, sqlx-exasol also provides:
- array-like parameter binding (also supported in compile-time checked queries)
- ETL capabilities through HTTP transport; only CSV implemented now but supporting other formats is trivial