diesel VS sqlx

Compare diesel vs sqlx and see what are their differences.

diesel

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

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. (by launchbadge)
Our great sponsors
  • InfluxDB - Access the most powerful time series database as a service
  • SonarQube - Static code analysis for 29 languages.
  • SaaSHub - Software Alternatives and Reviews
diesel sqlx
64 124
10,111 8,322
2.8% 6.3%
9.5 9.0
7 days ago 4 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.

diesel

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-03-20.
  • 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 | reddit.com/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.
  • I wanna be a crab.
    16 projects | reddit.com/r/rust | 27 Feb 2023
    “watched prime yell about VIM for hours” lmao well done, this got me. A lot of the resources people have already suggested are great! One thing I like to do after going through the documentation for a language is trying to build something like a simple rest api to get a better feel. Rocket (https://rocket.rs) and actix web (https://actix.rs) are popular web frameworks and then for ORM diesel (https://diesel.rs).
  • Looking for Rust Project Ideas for Semester Project - Any Suggestions?
    3 projects | reddit.com/r/rust | 25 Feb 2023
    You should minimise the non-Rust parts though, don't get tied up in anything else or your scope will quickly outgrow a two month deadline. Use something like https://dummyjson.com/ as a foundation to skip the need to find/generate/build database + content, or use a combination of postgres/postgrest to get a quick API + database and use faker to fill it up quickly. That'd allow you to use something like SQLx or https://diesel.rs/ in the application.
  • Rust and its friendly crates: Don't miss out on them!
    8 projects | dev.to | 4 Feb 2023
    diesel
  • Ormlite: An ORM in Rust for developers that love SQL
    4 projects | reddit.com/r/rust | 25 Jan 2023
    Congratulations to the release. I know all of this is hard work. I would like to invite you to submit a ormlite implementation to the diesel benchmark collection. As soon as that's merged you will get regular reports here. The relevant code is here in the diesel repository.
  • Destructive move in C++2
    3 projects | reddit.com/r/cpp | 17 Jan 2023
    Doing arbitrary syntax transformations in procedural macros is not powerful enough? Does C++ have something like serde or diesel?
  • State of Rust for web backends
    11 projects | reddit.com/r/rust | 20 Dec 2022
    I've been building a relatively small project with axum and diesel, and I'm pretty happy with it.
  • Using Rust at a startup: A cautionary tale
    5 projects | reddit.com/r/programming | 23 Nov 2022
    There's also Diesel and SeaORM for higher level interfaces.

sqlx

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-03-22.
  • What are the advantages of using Rust to develop KV databases?
    2 projects | reddit.com/r/rust | 22 Mar 2023
    Perhaps Rust has some nice crates that will assist your development, but you're going to have to evaluate whether their design decisions meet the needs of your design, especially if you want to handle powerloss without data loss whilst maintaining high performance. Here's an example of where a create chose design over performance https://github.com/launchbadge/sqlx/issues/2007
  • Why use Rust on the backend? by Adam Chalmers
    3 projects | reddit.com/r/rust | 21 Mar 2023
    SQLx's query macros act like format macros, and the database is apparently smart enough to not treat bind parameters as part of the SQL.
    3 projects | reddit.com/r/rust | 21 Mar 2023
  • Why use Rust on the back end?
    6 projects | news.ycombinator.com | 20 Mar 2023
    > Doesn't it need to run introspection queries to check the table structures?

    Yes, but it can also run in 'offline' mode where it builds against saved metadata [0]

    0: https://github.com/launchbadge/sqlx/blob/main/sqlx-cli/READM...

  • Arbitrary code execution during compile time - rust
    3 projects | reddit.com/r/rust | 18 Mar 2023
    well it does have its usecases. e.g. https://github.com/launchbadge/sqlx
  • Things I learned after getting users
    3 projects | news.ycombinator.com | 13 Mar 2023
    I felt the same way until I found sqlx (https://github.com/launchbadge/sqlx). The package lets you write sql in your app with compile-time checks. Was so much easier to get up and running than learning a new ORM.
    3 projects | news.ycombinator.com | 13 Mar 2023
    If writing SQL directly, what process do you use to update your queries during schema changes? Do you rely on a test suite to catch errors then update queries by hand? Are you using compile-time checks through libraries like sqlx [1]?

    [1]: https://github.com/launchbadge/sqlx

  • Improving sqlx-related Compile Times
    2 projects | reddit.com/r/rust | 13 Mar 2023
    You probably know about this already but we've finally landed the change to one file per query in offline mode which should provide both performance and ergonomic improvements, especially when it comes to merging multiple Git branches that change queries.
  • Programming block?
    4 projects | reddit.com/r/ADHD_Programmers | 3 Mar 2023
    What I really like about it (apart from being a really nicely designed language, that is very expressive, powerful, performant and one of the safest because of the strict typing/memory management), is that you can kind of focus on just programming, without all the hassles around setting up a project, thinking about building/deploying etc. as tooling is really awesome as well (rust-analyzer, cargo, crates.io etc.). Libraries are usually high-quality and innovative (which is IMHO not so true for a lot of different other languages, including the ones you mentioned). E.g. if you want to create a web-server/API you could try something like this (my current recommendation): https://github.com/tokio-rs/axum and https://github.com/launchbadge/sqlx for good integration of typed sql in Rust or if you want something higher level: https://github.com/SeaQL/sea-orm
  • Install a CLI in a project (not globally)
    6 projects | reddit.com/r/rust | 24 Feb 2023
    It doesn't allow you to install third-party binaries, but it allows you to make your own binaries runnable with something similar to npx. And, as sqlx-cli is also available as a library, you can make an xtask which just runs that.

What are some alternatives?

When comparing diesel and sqlx 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

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

rusqlite-model - Model trait and derive implementation for rusqlite

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

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

actix-web - Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.