For a SQL query builder without a full ORM, the strongest matches are masterminds/squirrel (Squirrel is a Go SQL query builder that lets), catfan/medoo (Medoo is a lightweight PHP SQL query builder that) and doctrine/dbal (Doctrine DBAL provides a fluent query builder with method). baomidou/mybatis-plus and go-gorm/gorm round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.
Lightweight libraries that programmatically construct SQL queries while maintaining full control over database interactions.
Squirrel is a Go database library and SQL query builder that provides a programmatic interface for constructing and executing SQL statements. It enables the creation of queries using a fluent interface to avoid manual string concatenation. The library functions as a SQL dialect generator, producing queries formatted for specific database engines by adjusting placeholders and syntax to match target requirements. This allows for the generation of SQL compatible with multiple different database environments. Beyond query construction, the project covers the execution of generated statements aga
Squirrel is a Go SQL query builder that lets you construct parameterized queries programmatically with a fluent method-chaining API and supports multiple database
Medoo is a lightweight PHP database abstraction layer and SQL query builder. It serves as a minimal database wrapper that provides a unified API to execute queries across multiple SQL engines, translating PHP method calls into specific database dialects. The project enables multi-dialect SQL interfacing, allowing a single codebase to interact with various backends including MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, Oracle, and Sybase. It uses prepared statement parameterization to prevent injection attacks while maintaining a programmatic approach to constructing complex SQL statements. The
Medoo is a lightweight PHP SQL query builder that constructs queries programmatically with prepared statements and supports multiple databases, fitting the core intent of a lean builder without ORM overhead, though its API uses arrays rather than explicit method chaining, which<|begin▁of▁file|>We need to stop the generation here because it seems cut off. Actually from the assistant's perspective, outputting everything after the reasoning sentence fragmented? Let me regenerate properly and truncate the reasoning to exactly one or two sentences withoutmatch Medoo is a lightweight PHP SQL query builder that constructs queries programmatically with prepared statements and supports multiple databases
This project is a SQL database abstraction layer that provides a consistent object-oriented interface for interacting with multiple relational database systems. It includes a driver wrapper to standardize connections and result sets, a fluent query builder for constructing portable SQL statements, and a type mapper for converting database-specific data types into native application types and vice versa. The library enables programmatic schema management through a schema manager that can introspect database metadata, model structures as objects, and generate the SQL required to migrate between
Doctrine DBAL provides a fluent query builder with method chaining, parameterized queries, and support for multiple databases (MySQL, PostgreSQL, etc.), covering all the requested SQL operations while remaining a library-level tool rather than a full ORM.
MyBatis-Plus is a persistence framework extension for Java that simplifies data access by reducing boilerplate code. It provides a toolkit for automating common database operations, utilizing dynamic query wrappers and a system for automated CRUD generation. The project distinguishes itself through a code generation system that produces mapper, model, service, and controller layers based on database metadata. It also implements a security layer that prevents SQL injection through input sanitization and blocks dangerous global update or delete operations to prevent accidental data loss. The f
MyBatis-Plus is an ORM persistence framework that extends MyBatis with dynamic query wrappers and automated CRUD, not a lightweight library for programmatic SQL string construction—it carries the full overhead of an ORM layer rather than generating raw SQL in isolation.
GORM is a developer-focused object-relational mapping library for Go that provides a comprehensive data persistence framework. It serves as a database access layer, allowing developers to map application structures to database tables and perform CRUD operations using a fluent, type-safe query builder instead of writing raw SQL. The library distinguishes itself through its association-aware persistence, which automatically tracks and synchronizes complex entity relationships during database operations. It utilizes a driver-agnostic interface to maintain consistent behavior across various stora
GORM is a full ORM framework, not a lightweight library for building raw SQL strings — it adds object-relational mapping overhead rather than generating clean SQL without an ORM.
GF is a comprehensive Go application toolkit and web framework. It provides a set of libraries and tools for building scalable web applications, APIs, and enterprise-level software. The project features a driver-agnostic SQL database toolkit with a query builder and object mapper, alongside a dedicated framework for creating structured command line interfaces. It includes a project scaffolding tool to bootstrap application structures and automate development workflows. The toolkit covers several broader capability areas, including concurrent data management with thread-safe collections, cryp
GF is a full-featured Go web framework and application toolkit that includes a SQL query builder, but it is not a focused, lightweight library for programmatic SQL construction—its comprehensive scope and included object mapper make it overly heavy for this specific need.
sqlboiler is a database-first ORM generator for Go that analyzes an existing database schema to produce strongly typed structures and query helpers. It functions as a schema-driven code generator, transforming database tables and relationships into executable Go source code. The project distinguishes itself through a type-safe query builder that uses chainable modifiers to construct SQL statements, eliminating the need for raw string concatenation. It utilizes customizable text templates to generate source code, allowing for the aliasing of schema entities and the creation of custom templates
Sqlboiler is a database-first ORM generator that produces strongly typed query helpers, not a lightweight standalone SQL query builder—its code generation and ORM patterns add the overhead this search aims to avoid.
Sequelize is an object-relational mapping library that provides a unified interface for managing relational data through code. By implementing the Active Record pattern, it maps database tables to application objects, allowing developers to perform standard create, read, update, and delete operations using high-level method calls. The library abstracts complex database interactions by translating these calls into optimized, engine-specific SQL statements, ensuring consistent behavior across different database systems. The project distinguishes itself through a comprehensive suite of tools for
Sequelize is a full-featured ORM with object-relational mapping and model abstractions, not a lightweight library for programmatically building raw SQL queries, so it carries the ORM overhead you wish to avoid.
pg is a PostgreSQL object-relational mapper (ORM) for Go that maps Go structs to database tables and provides a fluent query builder for constructing SQL statements programmatically. At its core, it automatically generates CREATE TABLE statements from Go struct definitions using struct tags and naming conventions, and builds queries through method chaining with placeholder-based parameter binding to prevent SQL injection. The library distinguishes itself through relation-aware join generation that automatically constructs JOIN clauses for has-one, has-many, many-to-many, and polymorphic assoc
go-pg/pg is an ORM for Go that includes a fluent query builder, but its primary identity as a full object-relational mapper means it carries the ORM overhead you want to avoid, so it is not a standalone SQL query builder library.
Sequel is a relational database toolkit for Ruby that provides object-relational mapping, a fluent SQL query builder, and schema migration capabilities. It maps database tables to Ruby classes with support for associations, validations, lifecycle hooks, and eager loading, offering a comprehensive ORM layer for building data-centric applications. Sequel distinguishes itself through a plugin-based extension architecture that allows composable customization of models, databases, and datasets without relying on deep inheritance hierarchies. It includes a thread-safe connection pool with support f
Sequel includes a fluent SQL query builder, but it is bundled inside a full-featured ORM toolkit with model mapping, hooks, and validations — not the lightweight, ORM-free library you are looking for.
PostGraphile is an automated tool that converts a PostgreSQL database schema into a fully functional GraphQL API. It serves as a GraphQL execution engine and schema orchestrator, utilizing database schema introspection to retrieve strongly typed metadata directly from PostgreSQL. The project features a modular system for composing and standardizing GraphQL schemas through plugins, which manage naming conventions and connections. It includes a PostgreSQL query builder that constructs dynamic, SQL-injection-proof queries using tagged template literals. The system employs a declarative query pl
PostGraphile is primarily a GraphQL API generator that converts a PostgreSQL schema into a GraphQL endpoint; while it includes an internal SQL query builder, it is not a lightweight standalone library for programmatic SQL construction across multiple databases.
Peewee is a SQL object-relational mapper and query builder that provides an object-oriented interface for mapping application classes to relational database tables. It functions as a relational database toolkit for managing schemas, executing migrations, and handling complex table relationships. The project distinguishes itself by providing an asyncio database driver for non-blocking database operations, ensuring event loop responsiveness. It also supports semi-structured data storage, allowing the storage and querying of flexible JSON documents within traditional relational database systems.
Peewee is primarily an ORM and database toolkit, not a lightweight standalone SQL query builder; its query-building features come bundled with object-relational mapping overhead, which goes against the visitor's intent to avoid ORM complexity.
| Repository | Stars | Language | License | Last push |
|---|---|---|---|---|
| masterminds/squirrel | 7.9K | Go | NOASSERTION | |
| catfan/medoo | 4.9K | PHP | MIT | |
| doctrine/dbal | 9.7K | PHP | MIT | |
| baomidou/mybatis-plus | 17.4K | Java | Apache-2.0 | |
| go-gorm/gorm | 39.8K | Go | MIT | |
| gogf/gf | 13.2K | Go | MIT | |
| aarondl/sqlboiler | 7K | Go | NOASSERTION | |
| sequelize/sequelize | 30.3K | TypeScript | MIT | |
| go-pg/pg | 5.8K | Go | BSD-2-Clause | |
| jeremyevans/sequel | 5.1K | Ruby | other |