"db-api"-like project

One thing I like in Python is DB-API. The DB-API is not perfect; in fact each time I use it there are some things I keep running in to which I think stick out like a sore thumb -- but they aren't critical and I prefer it to how it was before DB-API.

For those who are unfamiliar with DB-API: It essentially defines the developer-exposed interface for a database client. It makes moving between database implementations easier, and allows developers to not have to relearn a completely new different way of thinking when switching to a different database client binding.

Is there anything similar for Rust? I found a sqlite3 binding which explicitly stated that it tried to mimic the bindings of a PostrgreSQL binding, which is the kind of talk I like.

I found https://github.com/rust-db which initially seemed promising, but it doesn't quite seem to be what I'm looking for. (They seem more geared to developing tools, which is also good).

A starting point could be defining a set of traits for database client bindings for querying and result iterations. Anyone know if there's any such project in progress? Or is there some defacto standard/template design which most database client binding seem to draw inspiration from?

awesome-rust is an amazing resource for discovering libraries

1 Like

Is there anything similar for Rust?

No. Type safety that most Rust user would expect from such project makes it a lot more complicated comparing to what other language do. The nearest thing is Diesel.

1 Like