# sqlx

13 Hacker News commenters recommended sqlx and 4 criticized it, November 2025 to November 2026. It was recommended in 8 of 13 months. It meets the Hacker Approved badge rule.

**Verdict:** Rust crate that checks SQL against your database at compile time, catching type errors early. Common caveat: dynamic queries are hard.

## Why people recommend it

- Compile-time SQL and type checks (2 comments): "getting a compile time error when SELECT query params or return values have type mismatches is extremely nice" ([source](https://news.ycombinator.com/item?id=49378784)) "it statically analyses the SQL in your program against the database and ensures the SQL is valid" ([source](https://news.ycombinator.com/item?id=48871906))
- Works well with Postgres (2 comments): "I've been using sqlx + postgres very successfully with claude in the last couple of months." ([source](https://news.ycombinator.com/item?id=47460159)) "SQLX with Postgres is my go to." ([source](https://news.ycombinator.com/item?id=45914697))
- Inspired other SQL libraries (2 comments): "That's actually the library that inspired me the most for building bun-sqlgen" ([source](https://news.ycombinator.com/item?id=48673096)) "I actually took a lot of inspiration from sqlx, which is really nice." ([source](https://news.ycombinator.com/item?id=48646848))
- Safe design, natural fit in Rust (2 comments): "sqlx's design choice to make dynamic queries hard is a logical choice from a safety standpoint" ([source](https://news.ycombinator.com/item?id=47078587)) "SQLx, which is a natural fit in Rust because of how Rust macros work" ([source](https://news.ycombinator.com/item?id=48868865))

## What people warn about

- Dynamic queries are hard to build (2 comments): "Whereas with sqlx you end up writing Rust that generates SQL strings, ie re-inventing query builders." ([source](https://news.ycombinator.com/item?id=47078391)) "Your building a string and tracking binds. It gets messy." ([source](https://news.ycombinator.com/item?id=47080960))
- Offline mode is opt-in (2 comments): "sqlx offline mode being opt-in instead of default is what bothers me" ([source](https://news.ycombinator.com/item?id=49379035)) "I also wish that it would be the default." ([source](https://news.ycombinator.com/item?id=49379251))
- Occasional bugs and rough edges (2 comments): "switch a project from some raw sqlx jank to Diesel" ([source](https://news.ycombinator.com/item?id=48955111)) "There's just a sqlx bug in 0.9." ([source](https://news.ycombinator.com/item?id=48396672))

## Alternatives hackers recommend

- [sqlc](https://hackerapproved.com/p/sqlc.md): 20 recommend
- [Ecto (Elixir)](https://hackerapproved.com/p/ecto.md): 17 recommend
- [jOOQ](https://hackerapproved.com/p/jooq.md): 13 recommend
- [Kysely](https://hackerapproved.com/p/kysely.md): 12 recommend
- [Jdbi](https://hackerapproved.com/p/jdbi.md): 6 recommend

## Cite as

Hacker Approved, "sqlx", https://hackerapproved.com/p/sqlx/ (counts from 1,795,640 Hacker News comments, November 2025 to November 2026).
