Overview
SQLx has been developed since late 2019. Its README describes it as an async, pure-Rust SQL crate with compile-time checked queries and no DSL. With the query! and query_as! macros, SQL is checked against a live development database (or offline metadata committed to the repo) during compilation, and the result types are inferred from it. Plain query() functions are available when you do not want compile-time checks.
It ships connection pooling, row streaming, prepared statement caching, nested transactions with save points, LISTEN/NOTIFY for PostgreSQL and an Any driver for choosing the database at run time. SQL Server support was removed in 0.7 pending a rewrite. The Postgres and MySQL drivers are pure Rust; SQLite uses the C library.
SQLx 0.9.0 was released on 6 May 2026. It added a sqlx.toml config for multi-database setups and type overrides, the smol and async-global-executor runtimes to replace async-std, and a SqlSafeStr requirement on query strings to discourage SQL injection. With that release the repository moved from LaunchBadge to the transact-rs organisation, because LaunchBadge had not owned or maintained it for some years.
Pricing and plans
| Plan | Price | What you get |
|---|---|---|
| SQLx | $0 | Dual-licensed: MIT or Apache 2.0 |
What it does
- Compile-time checked SQL
- query! macros verify SQL and infer column types against a development database or offline metadata.
- Async and runtime-agnostic
- Works with tokio, actix, smol and async-global-executor, with rustls or native-tls.
- Pooling and streaming
- Built-in connection pool, row streaming and statement caching.
- Migrations
- sqlx-cli creates and runs migrations, which can also be embedded in the binary.
- sqlx.toml
- Since 0.9, a config file for multiple databases, global type overrides and SQLite extensions.
Strengths and limitations
Strengths
- You write real SQL and still get type-checked results
- Async-first and widely used as the base for other crates, including SeaORM
- Pure Rust drivers for PostgreSQL and MySQL
- No DSL to learn
Limitations
- Compile-time checks need a reachable database or prepared offline metadata in CI
- Not an ORM: no relations, change tracking or query building beyond a basic QueryBuilder
- SQL Server support was removed in 0.7
- 0.9 changed query() to require SqlSafeStr, so dynamic strings must be wrapped in AssertSqlSafe
Who it suits
Good for
- Async Rust services on PostgreSQL
- Developers who want SQL with type safety and no ORM
- Teams that review SQL directly
Look elsewhere if
- Projects that need SQL Server
- Teams that want an ORM with relations (SeaORM or Diesel)
Pricing history
-
SQLx 0.9 released; repository moves to transact-rs
SQLx 0.9.0 added sqlx.toml, new runtimes and the SqlSafeStr requirement for query strings; the repository then moved from LaunchBadge to the transact-rs GitHub organisation. Source ↗
Alternatives to SQLx
| Tool | From | Free option | Stages |
|---|---|---|---|
| Entity Framework Core .NET ORM | — | ||
| Bun (Go ORM) SQL-first Go ORM | — | ||
| Kysely Type-safe TypeScript SQL query builder | — | ||
| SeaORM Async dynamic ORM for Rust | — | ||
| Active Record (Rails) Active Record ORM for Ruby on Rails | — | ||
| SQLAlchemy Python SQL toolkit and ORM | — |
Questions
Is SQLx an ORM?
No. The project says so itself; it is an async SQL toolkit with compile-time checked queries.
How does SQLx check queries at compile time?
The query! macros connect to a development database, or read offline metadata, during compilation to validate SQL and infer types.
Where did SQLx move?
After the 0.9.0 release in May 2026 the repository moved from the LaunchBadge organisation to transact-rs on GitHub.
Sources read for this page