Rust ORM with transparent mapping

⚓ rust    📅 2025-05-21    👤 surdeus    👁️ 5      

surdeus

Warning

This post was published 39 days ago. The information described in this article may have changed.

does Rust have a Python-like ORM like sqlalchemy with imperative mapping or C# EF Core? In these ORMs, you can describe your pure domain entities that will not know about the database in any way, you can use them in your program without knowing anything about the database. Is there such a thing in Rust?

Everything I see requires me to specify special macros in domain entities related to the database in one way or another, changing the attribute of a database entity requires me to use library classes, for example SeaORM:

pear.name = Set("Sweet pear".to_owned());

In python sqlalchemy (with imperative mapping) i just do:

pear.name = "smth"

On my domain entity (just usual python class)

I just want to keep my business logic clean and don't want it to know about database or ORM related details. I want to separately describe my business entities and separate structures that directly represent database tables, and then "link" them through ORM capabilities, so in my business logic I can work with my business entities and the changes will display in database (UoW pattern)

In fact, I could even put up with special macros on structures if the library allowed me to continue working with my entities as with ordinary structures in Rust, without thinking about classes from ORM.

4 posts - 3 participants

Read full topic

🏷️ rust_feed