A modern, type-safe ORM and SQL query generator for C++20, inspired by SQLAlchemy and Diesel.
sqlgen is a modern Object-Relational Mapper (ORM) and SQL query generator for C++20. It allows developers to interact with databases using a type-safe, fluent API, generating SQL queries at compile time to prevent errors and SQL injection vulnerabilities. It is inspired by popular ORMs like Python's SQLAlchemy and Rust's Diesel.
C++ developers building database-driven applications who need a type-safe, modern ORM solution. It is particularly suited for projects requiring high reliability, complex query composition, and support for multiple database backends.
Developers choose sqlgen for its strong compile-time guarantees, protection against SQL injection, and clean API that leverages C++20 features. Its integration with reflect-cpp provides seamless serialization and validation, making it ideal for building reliable ETL pipelines.
sqlgen is a reflection-based ORM and SQL query generator for C++-20, similar to Python's SQLAlchemy/SQLModel or Rust's Diesel.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Validates table schemas and queries at compile time to prevent errors like non-existent columns or type mismatches, as shown in the 'Type Safety and SQL Injection Protection' examples.
Uses parameterized queries and input validation (e.g., AlphaNumeric type) to secure against injection attempts, ensuring runtime safety.
Provides a fluent interface for building complex queries through chaining, enabling nested joins and subqueries similar to SQLAlchemy or Diesel.
Supports PostgreSQL, SQLite, MySQL/MariaDB, and DuckDB with listed underlying libraries, offering versatility across database systems.
Requires vcpkg or Conan for installation, with system dependencies (e.g., autoconf, bison) for some databases, increasing initial configuration effort.
Heavily relies on reflect-cpp for serialization and validation, forcing adoption of this specific library and reducing flexibility for other serialization methods.
Mandates C++20, excluding projects using older compilers or standards, which may be a barrier in legacy environments.