What problem does it solve?
sqlx provides a pragmatic approach to executing SQL in Rust without an ORM, offering compile-time verification of queries and safe async execution for database-backed applications. It ensures you can write raw SQL while catching errors at compile time.
Core Features & Use Cases
- Compile-time verification of queries with query! and query_as!.
- Async, non-blocking execution suitable for tokio, async-std, or actix.
- Database-agnostic support for PostgreSQL, MySQL, MariaDB, and SQLite.
- Not an ORM; focuses on safe, direct SQL execution with tooling.
- Use Case: Build high-performance microservices that require precise SQL control and minimal boilerplate.
Quick Start
Create a Rust project, add sqlx to Cargo.toml with the appropriate features (runtime and database), then establish a connection pool and run a compile-time checked query.