sqlx
Hacker ApprovedShares rank 3 of 8 SQL query builders by recommenders
Rust crate that checks SQL against your database at compile time, catching type errors early. Common caveat: dynamic queries are hard.
Rust crate that checks SQL against your database at compile time, catching type errors early. Common caveat: dynamic queries are hard.
17 people gave an opinion
- recommend it
- 13
- criticize it
- 4
- approval share
- 76%
Recommended in 8 of 13 months
- November 2025: recommended
- December 2025: not recommended
- January 2026: not recommended
- February 2026: recommended
- March 2026: recommended
- April 2026: recommended
- May 2026: not recommended
- June 2026: recommended
- July 2026: recommended
- August 2026: recommended
- September 2026: recommended
- October 2026: not recommended
- November 2026: not recommended (month in progress)
Why it carries the badge
- 13 people recommend itNeeds 10 or more, met.
- 3.3 recommenders for every criticNeeds 2 to 1 or better, met.
- Recommended in 8 of 13 monthsNeeds 4 or more, met.
The same three rules apply to every product, and the badge can’t be bought. How the badge works
What people say about it
The reasons people give, with the number of comments that give each one. Open a reason to read what they said.
Why people recommend it
Each mark is one comment
Compile-time SQL and type checks
“getting a compile time error when SELECT query params or return values have type mismatches is extremely nice”
Comment from 20 Aug 2026 in “Malicious Rust Crate Arrayref Runs a Build-Time Payload” “it statically analyses the SQL in your program against the database and ensures the SQL is valid”
Comment from 11 Jul 2026 in “Scarf has moved away from Haskell” Works well with Postgres
“I've been using sqlx + postgres very successfully with claude in the last couple of months.”
Comment from 20 Mar 2026 in “Java Is Fast. Your Code Might Not Be” “SQLX with Postgres is my go to.”
Comment from 13 Nov 2025 in “Building Rust Web Apps” Inspired other SQL libraries
“That's actually the library that inspired me the most for building bun-sqlgen”
Comment from 25 Jun 2026 in “Show HN: Bun-sqlgen – Type-safe raw SQL for Bun, no ORM” “I actually took a lot of inspiration from sqlx, which is really nice.”
Comment from 23 Jun 2026 in “Show HN: Bun-sqlgen – Type-safe raw SQL for Bun, no ORM” Safe design, natural fit in Rust
“sqlx's design choice to make dynamic queries hard is a logical choice from a safety standpoint”
Comment from 19 Feb 2026 in “Farewell Rust” “SQLx, which is a natural fit in Rust because of how Rust macros work”
Comment from 11 Jul 2026 in “Scarf has moved away from Haskell”
What people warn about
Each mark is one comment
Dynamic queries are hard to build
“Whereas with sqlx you end up writing Rust that generates SQL strings, ie re-inventing query builders.”
Comment from 19 Feb 2026 in “Farewell Rust” “Your building a string and tracking binds. It gets messy.”
Comment from 19 Feb 2026 in “Farewell Rust” Offline mode is opt-in
“sqlx offline mode being opt-in instead of default is what bothers me”
Comment from 20 Aug 2026 in “Malicious Rust Crate Arrayref Runs a Build-Time Payload” “I also wish that it would be the default.”
Comment from 20 Aug 2026 in “Malicious Rust Crate Arrayref Runs a Build-Time Payload” Occasional bugs and rough edges
“switch a project from some raw sqlx jank to Diesel”
Comment from 18 Jul 2026 in “Topcoat: The full full-stack framework for Rust” “There's just a sqlx bug in 0.9.”
Comment from 4 Jun 2026 in “Corporate America Is Starting to Ration AI as Cost Skyrockets”
Other SQL query builders people recommend
The four most recommended other SQL query builders, with the same counts for each, so you can compare like for like. The tick on each bar marks the 2 to 1 line the badge needs.
| Product | Recommend | Criticize | Approval | Months | Owned | Badge |
|---|---|---|---|---|---|---|
| sqlc | 20 | 4 | 83% | 9 | — | Approved |
| Ecto (Elixir) | 17 | 5 | 77% | 8 | — | Approved |
| sqlxThis page | 13 | 4 | 76% | 8 | — | Approved |
| jOOQ | 13 | 3 | 81% | 6 | — | Approved |
| Kysely | 12 | 1 | 92% | 6 | — | Approved |
What people said
19 of the 21 comments that mention it, newest first. Each links to the original comment.
“SQLx is much closer to my cup of tea than Toasty.”
“I also wish that it would be the default.”
“sqlx offline mode being opt-in instead of default is what bothers me”
“getting a compile time error when SELECT query params or return values have type mismatches is extremely nice”
“You’d have a better chance of getting your PR accepted into”
“switch a project from some raw sqlx jank to Diesel”
“it statically analyses the SQL in your program against the database and ensures the SQL is valid”
“SQLx, which is a natural fit in Rust because of how Rust macros work”
“I find rust's sqlx or java's jooq to be hitting the sweet spot”
“That's actually the library that inspired me the most for building bun-sqlgen”
“I actually took a lot of inspiration from sqlx, which is really nice.”
“There's just a sqlx bug in 0.9.”
“If you haven't tried writing a simple web service in Axum or Actix plus SQLx, you need to give it a try.”
“I've been using sqlx + postgres very successfully with claude in the last couple of months.”
“ended up settling on `sqlx` + hand-written SQL”
“Your building a string and tracking binds. It gets messy.”
“sqlx's design choice to make dynamic queries hard is a logical choice from a safety standpoint”
“Whereas with sqlx you end up writing Rust that generates SQL strings, ie re-inventing query builders.”
“SQLX with Postgres is my go to.”
Counts come from 1,795,640 Hacker News comments, November 2025 to November 2026. How we count. Report a mistake.