finds.dev

rbatis/rbatis

Compile Time Async Dynamic SQL ORM

View on GitHubHomepage ↗

★ 2,465RustApache-2.0updated Jun 2026

// the take

Rbatis is a Rust ORM that compiles dynamic SQL (written in either a Python-indentation style or MyBatis-style XML) into native Rust code at compile time, eliminating runtime SQL parsing overhead. It targets developers coming from Java/MyBatis backgrounds who want familiar patterns in Rust, and supports MySQL, PostgreSQL, SQLite, MSSQL, and a handful of others via a pluggable driver interface.

The compile-time codegen approach is the real differentiator — SQL templates are parsed by proc macros and emitted as Rust code, so there's no interpreter in the hot path at runtime. The html_sql format is a genuine port of MyBatis XML mapper syntax including `<where>`, `<set>`, `<foreach>`, and `<if>` tags, which makes migration from Spring/MyBatis projects significantly less painful than rewriting queries from scratch. The driver abstraction is clean enough that community drivers for Oracle, TDengine, and Turso exist and work without forking the core. The `unsafe forbidden` badge is enforced and meaningful for a database library.

The `rbs::Value` intermediate type — used as the serialization layer between Rust types and SQL parameters — adds a non-obvious layer of indirection that makes type errors harder to trace and breaks IDE type inference for query results. The py_sql syntax is a liability: mixing Python-style indentation with Rust code means a misaligned space changes behavior silently, and it has no formal grammar spec in the repo. English documentation lags noticeably behind the Chinese README, and the hosted docs site (rbatis.github.io) has missing sections. At ~2400 stars it's modestly adopted compared to sqlx or sea-orm, meaning fewer Stack Overflow answers and community examples when something breaks.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
2,465
Forks
169
Language
Rust
License
Apache-2.0
Last commit
5 Jun 2026

// nearby

If rbatis isn't quite it.

All repos →