sqlx VS diesel

Compare sqlx vs diesel and see what are their differences.


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


A safe, extensible ORM and Query Builder for Rust (by diesel-rs)
Our great sponsors
  • Onboard AI - Learn any GitHub repo in 59 seconds
  • Revelo Payroll - Free Global Payroll designed for tech teams
  • SonarQube - Static code analysis for 29 languages.
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
sqlx diesel
140 78
9,968 11,004
2.4% 1.1%
0.0 0.0
2 days ago 3 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 sqlx. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-07-04.
  • Introducing SQLPage : write websites entirely in SQL
    8 projects | /r/rust | 4 Jul 2023
    I'm considering making my own wrapper over lower-level database drivers. There are a lot of features in sqlx that I don't need, and the latest version seems to have removed useful data structures that SQLPage is using. It also removed support for SQL Server.
    8 projects | /r/rust | 4 Jul 2023
    sqlx to interface with multiple databases (I am considering moving to something else to support more databases, though)
  • SQLx 0.7 released! Offline mode usability improvements, performance fixes and major upgrades across the board!
    6 projects | /r/rust | 3 Jul 2023
    The biggest thing to note in this release is the restructuring of the project and the removal of the MSSQL driver as it was not at the same maturity and usability level as the other drivers. As previously announced (https://github.com/launchbadge/sqlx/discussions/1616), we have plans to introduce a fully featured replacement as a premium offering, alongside drivers for other proprietary databases, with the goal to support full-time development on SQLx.
    6 projects | /r/rust | 3 Jul 2023
  • Is ORM still an anti-pattern?
    15 projects | news.ycombinator.com | 27 Jun 2023
  • PHP to Golang
    9 projects | /r/golang | 3 Jun 2023
  • New Rustacean Looking For Guidance
    6 projects | /r/rust | 11 May 2023
  • Why ORMs are so hated?
    4 projects | /r/golang | 11 May 2023
    Thanks for sharing your experiences. I've been looking to get into snowflake for some time (even opened this https://github.com/launchbadge/sqlx/issues/986) . We thought to move to it years ago, but there's no way it was going to replace a significant amount of the mariadb we're running, and unless it did I wasn't looking forward to managing 2 DBs.
  • Prá galera curiosa sobre Rust, alguns "contras" a considerar.
    4 projects | /r/brdev | 10 May 2023
  • What ORM do you use?
    6 projects | /r/rust | 9 May 2023
    however, a much worse problem is its inability to do dynamic queries. If you have two queries that only differ in a column name, you're forced to copy paste the entire query. You can try and hack around it, but it's ugly either way. Here's a good overview, with no really good solutions.


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-09-11.
  • Rust & MySQL: connect, execute SQL statements and stored procs using crate sqlx.
    3 projects | dev.to | 11 Sep 2023
    I did look at mysql initially. Then I started checking other crates. Diesel is an Object Relation Model (ORM), I'm not yet keen on taking on the complication of learning ORM, I give this crate a pass in the meantime.
  • Queryx: An Open-Source Go ORM with Automatic Schema Management
    3 projects | /r/golang | 5 Jul 2023
    I would recommend people look at diesel from Rust for how nice it could be. https://diesel.rs/ Look at the complex queries example. So much more readable and easier to understand.
  • /r/startrek/ migrates to lemmy
    2 projects | news.ycombinator.com | 15 Jun 2023
    Lemmy is written in Rust using Actix Web and Diesel.rs.



  • 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

What are some alternatives?

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

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

rustorm - an orm for rust

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

tokio - A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...

r2d2 - A generic connection pool for Rust

rusqlite-model - Model trait and derive implementation for rusqlite

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

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

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

quaint - SQL Query AST and Visitor for Rust