diesel VS r2d2

Compare diesel vs r2d2 and see what are their differences.


A safe, extensible ORM and Query Builder for Rust (by diesel-rs)


A generic connection pool for Rust (by sfackler)
Our great sponsors
  • SonarLint - Clean code begins in your IDE with SonarLint
  • InfluxDB - Access the most powerful time series database as a service
  • SaaSHub - Software Alternatives and Reviews
diesel r2d2
72 1
10,501 1,278
1.9% -
9.0 1.3
9 days ago 14 days ago
Rust Rust
Apache License 2.0 Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of diesel. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-05-29.
  • Backend API recommendations
    2 projects | /r/rust | 29 May 2023
    for psql i feel like there's a wealth of things to choose from, like diesel perhaps https://crates.io/crates/diesel
  • Diesel 2.1
    5 projects | /r/rust | 26 May 2023
    Essentially you would need to implement Backend + Connection (+ the whole bunch of helper traits) for this type. That's ~1kloc for all of that. The PR that introduced this feature has more details on the exact implementation that's generated.
  • New Rustacean Looking For Guidance
    6 projects | /r/rust | 11 May 2023
  • What ORM do you use?
    6 projects | /r/rust | 9 May 2023
    some things are barely expressible in the type system. For example, window functions are unavailable (the issue is six years old). You can use raw SQL, but then it has the same problems sqlx has
  • Trait object with generic funtion: don't understand how to do it
    3 projects | /r/rust | 2 May 2023
    Have you considered using a library such as sqlx or Diesel? They’ll handle this for you and supports multiple backends
  • Diesel 2.0.4
    2 projects | /r/rust | 18 Apr 2023
    This is a patch release that contains several bugfixes. Notably it contains a workaround for a name resolution bug in rust-analyzer that affected diesel's DSL. With this rust-analyzer should be able to provide type hints and completions in many more cases than before, although there are still issues with specific constructs including queries containing .filter()/.inner_join() and .left_join() expressions. These are still not recognized correctly by rust-analyzer.
  • How to handle unknown types?
    2 projects | /r/rust | 2 Apr 2023
    I can provide an example how to handle these kind of setup with diesel: https://github.com/diesel-rs/diesel/blob/master/diesel_dynamic_schema/tests/dynamic_values.rs
  • Why use Rust on the back end?
    6 projects | news.ycombinator.com | 20 Mar 2023
    Please reach out on the diesel discussion forum[1] about the lacking dev experience. I'm happy to discuss these issues and potential solutions there.

    [1] https://github.com/diesel-rs/diesel/discussions

  • How to create a web app in Rust with Rocket and Diesel
    5 projects | dev.to | 9 Mar 2023
    As is customary for most web frameworks, Rocket allows you to use object-relational mappers (ORMs) as a data access layer for your application. Rocket is ORM agnostic, which means you can use any Rust ORM of your choice to access your database in your Rocket application. In this article, we’ll use Diesel ORM as our ORM of choice as it’s one of the most popular Rust ORMs. At the time of writing, Diesel ORM supports PostgreSQL, MySQL, and SQLite databases.
  • Hey Rustaceans! Got a question? Ask here (10/2023)!
    6 projects | /r/rust | 6 Mar 2023
    The Diesel getting started guide is explicitly written for using PostgreSQL as your database system. It is using some parts of SQL that are not supported by SQLite. You can follow the equivalent SQLite code by looking at this diesel example. In the concrete case that error is caused by the fact that only quite new SQLite versions support returning clauses. These support is behind an off-by-default feature flag and requires using an up to date SQLite version.


Posts with mentions or reviews of r2d2. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-04-13.

What are some alternatives?

When comparing diesel and r2d2 you can also consider the following projects:

sea-orm - 🐚 An async & dynamic ORM for Rust

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

rustorm - an orm for rust

rbatis - Rust Compile Time ORM robustness,async, pure Rust Dynamic SQL

redis-rs - Redis library for rust

rusqlite-model - Model trait and derive implementation for rusqlite

deuterium-orm - Fully typed SQL query builder for Rust [deprecated]

rust-postgres - Native PostgreSQL driver for the Rust programming language

tikv - Distributed transactional key-value database, originally created to complement TiDB

quaint - SQL Query AST and Visitor for Rust

prisma-client-rust - Type-safe database access for Rust

rust-mysql-simple - Mysql client library implemented in rust.