Skip to content
Search

SQLX

lastmod 2025-08-04created 2025-08-042 edits

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.

Open-source Rust-based SQL toolkit

About

  • An asynchronous (async), pure Rust SQL Crate that uses Rust macros to validate SQL queries at compile time without a DSL
    • Not an ORM! : Ideal for projects that want to use SQL as-is without an ORM
  • Supports databases such as PostgreSQL, MySQL, MariaDB, SQLite
    • Easy compile-time checks by specifying DATABASE_URL in a .env file
  • Pure Rust implementation (MySQL/MariaDB drivers are written 100% in Rust; SQLite integrates with the C library), designed to be safe without unsafe code, so highly reliable
  • Compatible with major Rust async runtimes such as Tokio, async-std, actix and with various TLS backends, and usable platform-independently
  • MIT/Apache 2.0 dual license, widely usable in open-source and commercial projects

Features

  • Connection pooling with sqlx::Pool
  • Asynchronous Row streaming of data from the database
  • Automatic per-connection query preparation and caching
  • Unprepared (non-Prepared) queries can also be run easily, with results returned as the same Row type
  • TLS encrypted connections on supported DBs (MySQL, MariaDB, PostgreSQL)
  • Asynchronous PostgreSQL notification support : LISTEN and NOTIFY
  • Nested transaction support using Savepoints
  • AnyPool support for selectively swapping the DB driver at runtime

See also

Favorite site

author Zer0 sitemap