Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. sea-query

sea-query

NOASSERTIONRust1.0.0

A dynamic SQL query builder for Rust that supports MySQL, PostgreSQL, and SQLite with a unified API.

Visit WebsiteGitHubGitHub
1.7k stars266 forks0 contributors

What is sea-query?

SeaQuery is a dynamic SQL query builder for Rust that allows developers to construct SQL queries programmatically using an abstract syntax tree (AST). It solves the problem of building complex, runtime-generated SQL queries with proper parameter binding and cross-database compatibility. The library provides a unified API for MySQL, PostgreSQL, and SQLite, making it easier to write database-agnostic code.

Target Audience

Rust developers working with SQL databases who need to build dynamic queries, such as those constructing filters based on user input or maintaining cross-database applications. It's particularly useful for developers using or building ORMs like SeaORM.

Value Proposition

Developers choose SeaQuery for its type-safe, ergonomic API that eliminates SQL injection risks and manual parameter binding. Its unique selling point is the ability to write a single query logic that works across multiple database backends while providing advanced features like complex condition builders and schema manipulation.

Overview

🔱 A dynamic SQL query builder for MySQL, Postgres and SQLite

Use Cases

Best For

  • Building dynamic SQL queries based on runtime conditions or user input
  • Writing database-agnostic applications that support MySQL, PostgreSQL, and SQLite
  • Creating type-safe query builders for Rust ORMs or data access layers
  • Generating complex WHERE clauses with nested AND/OR conditions
  • Programmatically defining and altering database schema in migrations
  • Avoiding SQL injection and parameter binding errors in raw SQL

Not Ideal For

  • Projects with exclusively static SQL queries that never change at runtime
  • Teams heavily invested in MS SQL Server without access to SeaORM X
  • Applications where raw SQL performance and direct control are critical, with no tolerance for abstraction overhead
  • Simple CRUD operations better handled by higher-level ORMs without dynamic query needs

Pros & Cons

Pros

Dynamic Query Construction

Enables runtime query building with a fluent interface, using methods like `apply_if` to conditionally add clauses without manual string concatenation, as shown in the README's dynamic query example.

Safe Parameter Binding

Automatically handles parameter sequencing to prevent SQL injection and 'off-by-one' errors, demonstrated in examples where values are injected with proper $N placeholders.

Cross-Database Support

Provides a unified API for MySQL, PostgreSQL, and SQLite, allowing single-source query logic with backend-specific adjustments, evident in the ON CONFLICT clause examples.

Complex Condition Builder

Supports arbitrarily nested WHERE/HAVING conditions using `Cond::any()` and `Cond::all()`, respecting operator precedence without cluttering parentheses, as illustrated in the condition builder section.

Cons

Limited MS SQL Server Support

MS SQL Server support is only available under SeaORM X, a paid plan, which restricts free usage and may require additional cost for teams relying on that database.

Configuration Complexity

Relies on numerous optional feature flags for type support and backends (e.g., `with-chrono`, `backend-postgres`), increasing setup complexity and potential dependency bloat.

Escape Hatch Dependency

For highly complex queries, the README admits needing the `raw_query!` macro as an escape hatch, indicating the builder doesn't cover all edge cases, requiring fallback to raw SQL.

Frequently Asked Questions

Quick Stats

Stars1,738
Forks266
Contributors0
Open Issues62
Last commit21 days ago
CreatedSince 2020

Tags

#query-builder#orm#database#postgres#sqlx#sql-ast#sql-query-builder#postgresql#mariadb#type-safe#mysql#sqlite#rust#sql

Built With

R
Rust

Links & Resources

Website

Included in

Rust56.6k
Auto-fetched 16 hours ago

Related Projects

QdrantQdrant

Qdrant - High-performance, massive-scale Vector Database and Vector Search Engine for the next generation of AI. Also available in the cloud https://cloud.qdrant.io/

Stars33,545
Forks2,520
Last commit19 hours ago
SurrealDBSurrealDB

A scalable, distributed, collaborative, document-graph database, for the realtime web

Stars32,748
Forks1,311
Last commit18 days ago
RustFSRustFS

🚀2.3x faster than MinIO for 4KB object payloads. RustFS is an open-source, S3-compatible high-performance object storage system supporting migration and coexistence with other S3-compatible platforms such as MinIO and Ceph.

Stars30,153
Forks1,326
Last commit18 hours ago
TursoTurso

A SQL database in Rust: SQLite-compatible, now also speaking Postgres (experimental). The LLVM of databases.

Stars23,381
Forks1,201
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub