Obviously I'm a Rust noob, so please bear that in mind. Specifically I have not used any Rust DB library.
Many readers will be too and will be relying on choices made here.
After a cursory review of Diesel issue: diesel-rs/diesel/issues/399 I'm nervous about sqlx.
I don't think you addressed their substantive reasons for not offering an async API.
Are you indicating the sqlx has resolved those issues in their crate?
If so could you say so explicitly? It would also be informative to know if it is your opinion that the Diesel reservations are unfounded? Unreasonably conservative? You didn't hold back on the use of executable business documents ;)
Frank and forthright is generally valuable.
In fact the Diesel reasons for their choice of sync and your reasons for recommending a relational DB are pretty much the same. Repurposing you relational DB statement, one could say this is reasonable description of the state-of-play in Diesel:
Syncronous database APIs are reasonably good as jack-of-all-trades: they will often be a good choice when
building the first version of your application, supporting you along the way while you explore the
constraints of your domain.
Yet when it comes to a DB library you guide to a choice, sqlx, that IMO is high risk, for no return that I'm aware of. The risk is some less experienced user relying on the async API while using transactions. I could be wrong but there is no reasonable assurance that your app will only hit issues with transaction issues that leave incomplete transactions at very high 'Google' scale volumes.
The risk-return trade-off gets worse for sqlx when you consider that there are Rust crates r2d2
and bb8
, helping you handle increased workloads. If your app scales beyond that capacity, (+sharding) then you should be looking at the toys the big kids are playing with.
While I haven't read the whole book, I wonder if there isn't a lost opportunity to add r2d2
, bb8
, or some such crate, as a step to production? Perhaps this comes up later?