OSS TanbouSign in with GitHub

validate SQL queries and schemas with Rust's type system through an ORM and query builder

OSS scale score 282.5OSS health 100
About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
14,193
Primary language
Rust
License
Apache-2.0
Repository last updated
Oct 5, 2026
On this page

Overview

Diesel is an ORM and query builder for Rust. It represents database schemas in Rust types and provides typed query construction, model loading and persistence, migrations, and raw SQL across PostgreSQL, MySQL, SQLite, and MariaDB backends.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Use schema and type information to catch query mismatches earlier

Diesel represents schemas through Rust constructs such as table! and combines them with typed query builders and model types. Selectable and backend checks can improve compiler errors when Rust fields do not match SQL-side expressions.

Sources: [2][4]

Handle CRUD, migrations, and raw SQL in one database layer

The README demonstrates select, insert, and update queries as well as raw SQL for cases that do not fit the query builder. Diesel CLI manages schema migrations and can generate schema.rs from a database.

Sources: [2][3]

Best fit

Fits Rust backends prioritizing type safety with relational databases

It works well for applications using PostgreSQL, MySQL, SQLite, or MariaDB that want schema-aware query construction and repository-managed migrations.

Sources: [2][3]

Before adoption

Check Rust 1.86+, native database dependencies, and patch updates

The 2.3.13 workspace requires Rust 1.86.0. Depending on the backend, libpq, libmysqlclient, or libsqlite3 may be needed, while the CLI offers bundled features. Version 2.3.13 also fixes SQLite memory-safety issues and generated-schema code-injection risks, making current patch releases important within the 2.3 line.

Sources: [5][3][6]

Official sources

  1. [1]diesel-rs/diesel — GitHub repository(2026-10-06)
  2. [2]Diesel 2.3.13 — README(2026-10-06)
  3. [3]Diesel CLI 2.3.13 — README(2026-10-06)
  4. [4]Diesel 2.3.13 — crate documentation(2026-10-06)
  5. [5]Diesel 2.3.13 — workspace Cargo.toml(2026-10-06)
  6. [6]Diesel 2.3.13 release(2026-10-06)
Supplemental curator note

Diesel's strength is representing database schemas in Rust types so query mismatches can be caught earlier. Its CLI and database drivers also bring native-library requirements, so reproduce the same backend dependencies across development, CI, and containers.

Try it in 3 steps

  1. 1

    Install Diesel CLI 2.3.13 with bundled SQLite

    Pin the reviewed CLI version and build SQLite as a bundled dependency. Rust 1.86 or newer and a C compiler are required.

    cargo install diesel_cli --version 2.3.13 --no-default-features --features "sqlite-bundled"
  2. 2

    Prepare the official SQLite example and run its migrations

    Clone the official Getting Started SQLite example and apply its included migrations to test.db.

    git clone --depth 1 --branch v2.3.13 https://github.com/diesel-rs/diesel.git && cd diesel/examples/sqlite/getting_started_step_3 && echo "DATABASE_URL=file:test.db" > .env && diesel migration run
  3. 3

    Run a typed query

    Run the official show_posts binary and verify that the generated schema and Diesel query builder connect to SQLite successfully.

    cargo run --bin show_posts
Check the official README

Growth

Growth trends · Last 30 days

14,193 Stars

Trend data is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • mysql
  • orm
  • postgresql
  • query-builder
  • rust
  • sqlite
Stars
14,193
Forks
1,247
Watchers
108
Open issues
167
Contributors
393
Owner type
Organization
Primary language
Rust
License
Apache-2.0
Repository last updated
Oct 5, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?