Lightweight libraries that programmatically construct SQL queries while maintaining full control over database interactions.
Kysely is a TypeScript SQL query builder that provides a type-safe interface for constructing and executing database queries. It functions as a database layer that ensures schema compliance and prevents runtime errors by using a fluent interface and a programmable way to build complex SQL statements. The project features a type-safe database layer capable of inferring return types and aliases from SQL selections and joins. It also includes a SQL migration manager to track and apply schema changes across different environments to keep database versions synchronized. The toolkit covers relational database integration through dynamic query construction and the execution of raw SQL statements. It allows for the creation of parameterized SQL snippets and the ability to reference tables and columns dynamically at runtime.
Kysely is a type-safe, fluent SQL query builder that provides a programmatic interface for constructing queries and executing raw SQL without the heavy abstraction of a full ORM.
Knex is a multi-dialect database client that provides a programmatic SQL query builder, a connection pool manager, and a versioned schema migration tool. It enables programmatic database interaction across multiple SQL engines, including PostgreSQL, MySQL, SQLite3, SQL Server, CockroachDB, and Oracle. The project distinguishes itself through a fluent interface for constructing complex SQL statements and a dedicated framework for database seeding. It utilizes specialized dialects to translate generic query representations into database-specific syntax while maintaining a consistent API across different vendors. The platform covers a broad range of relational database management capabilities, including atomic transaction control, schema definition, and relational constraint management. It also provides tools for query result pagination, stream-based processing for large datasets, and the ability to execute stored procedures and raw SQL expressions. A command-line interface is available for automating the execution of database migrations and seeding workflows.
Knex is a comprehensive SQL query builder that provides a fluent API, supports raw SQL execution, and offers database-agnostic query generation with built-in schema introspection tools.
MyBatis-Flex is an object-relational mapping framework for Java that extends MyBatis with a fluent API and automated CRUD operations. It provides a data access suite featuring an automatic CRUD data mapper, a type-safe SQL query builder, and a row-based query engine for manipulating records without predefined entity classes. The framework includes a multi-dialect SQL translator that converts generated syntax across different database engines, such as MySQL, PostgreSQL, and Oracle. It further distinguishes itself by offering annotation-free entity mapping using runtime reflection and naming conventions, alongside configurable strategies for automatic primary key generation. The library covers broad capability areas including type-safe query construction with support for joins and subqueries, dynamic database result paging, and lightweight data access abstractions to reduce boilerplate code.
This is an ORM framework that includes a robust, fluent SQL query builder as a core component, allowing you to construct queries programmatically without being strictly forced into full entity-based abstractions.
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, cryptographic operations for security, and a stack-aware error handling system. It also provides utilities for background task scheduling, adapter-based configuration management, and local service orchestration for containerized infrastructure.
This toolkit includes a robust, driver-agnostic SQL query builder that supports fluent API construction and parameterized queries, though it is part of a larger framework rather than a standalone library.
TypeORM is an object-relational mapper for TypeScript and JavaScript that bridges the gap between object-oriented application code and relational database tables. It provides a comprehensive data persistence layer that allows developers to define database entities using class decorators or configuration objects, enabling seamless interaction with data through object-oriented patterns. The project distinguishes itself through a flexible architecture that supports both the data mapper and repository patterns, alongside a fluent query builder that translates high-level method calls into platform-specific SQL. It includes a robust schema synchronization engine that automatically generates and applies migrations, ensuring that database structures remain consistent with application models. Furthermore, it offers specialized support for hierarchical data modeling, vector similarity search, and cross-database querying, allowing for sophisticated data management across diverse storage engines. Beyond its core mapping capabilities, the framework provides extensive tools for managing database connections, including support for replication, multi-database routing, and atomic transaction management. It also features a lifecycle event system for executing custom logic during data operations, as well as comprehensive performance optimization utilities like relation loading strategies, result caching, and query analysis. The project is designed for cross-platform compatibility, supporting various relational and document-based database drivers in environments ranging from Node.js servers to browser and mobile applications.
TypeORM is a full-featured Object-Relational Mapper that includes a powerful fluent query builder, making it a viable tool for programmatic SQL construction even though it provides more abstraction than a standalone 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 for database sharding, read/write splitting across replicas, and nested transactions with savepoint rollback. The library also provides a schema migration DSL with reversible steps, automation tools for database content copying and an interactive shell, and fine-grained control over connection management for multi-server setups. Beyond its core ORM and query capabilities, Sequel includes a data validation framework with built-in helpers and schema-driven validation generation, a lifecycle callback system covering create, update, destroy, and transaction events, and serialization support for CSV, JSON, XML, and other formats. It offers model instance caching, prepared statement execution, and testing utilities such as transaction-based test isolation and truncation-based cleanup. The library also provides logging, structured error details, and mass assignment protection for security.
Sequel provides a powerful and fluent SQL query builder that can be used independently of its ORM features, allowing you to construct complex, parameterized queries without being forced into a full object-relational mapping workflow.
This project is a PostgreSQL client library and SQL query builder for JavaScript and TypeScript. It provides a low-level database driver and connection manager to handle database sessions, along with a logical replication client for monitoring real-time changes. The library distinguishes itself with a high-performance bulk data streamer that utilizes the database copy command for importing and exporting large datasets. It also implements a logical replication protocol to facilitate real-time database synchronization through change subscriptions and channel-based notifications. The toolset covers broad capability areas including dynamic query composition using parameterized templates, transaction management with automatic commit and rollback, and connection pool management with support for failover hosts. It further includes utilities for custom data type serialization, result set streaming via cursors, and protocol-level query cancellation.
This library provides a robust programmatic interface for constructing and executing SQL queries with parameterized templates, though it is specifically optimized for PostgreSQL rather than being fully database-agnostic.
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. The toolkit covers a broad set of capabilities, including the construction of complex SQL queries via a composable programmatic interface and the management of many-to-many relationships and foreign key resolution. It includes utilities for bulk data operations, full-text search, and database introspection to generate models from existing schemas. Connection management is handled through pooling and transaction control to ensure data integrity.
Peewee is a full-featured ORM that includes a robust, fluent programmatic interface for building SQL queries, though it provides more abstraction than a standalone query builder.
sqlx is a set of extensions for the Go database/sql package that reduces boilerplate code by automating the mapping of database query results directly into structs and slices. It provides a wrapper around standard database types to eliminate manual row scanning and repetitive error handling. The project distinguishes itself through named parameter binding and query placeholder rebinding, which translate generic markers into driver-specific symbols. It also enables dynamic SQL execution by allowing the application to read and execute SQL statements directly from the filesystem. The library covers a broad range of database integration capabilities, including reflection-based struct mapping, dynamic list expansion for search queries, and generic map scanning for unknown schemas. It further supports custom type conversion via standard scanner and valuer interfaces.
This library acts as a set of extensions for the standard database interface to simplify row-to-struct mapping and parameter binding, but it does not provide the fluent API required to programmatically construct SQL queries.
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 storage engines and employs a reflection-based system to map programming language types to database schemas. Developers can further customize behavior using a callback-based hook system that executes logic at specific points in the operation lifecycle. Beyond core mapping, the project provides robust support for transaction management, connection pooling, and automated schema migrations. It handles complex relational modeling, including one-to-one, one-to-many, and many-to-many associations, while offering advanced features like eager loading, soft deletes, and conflict resolution strategies for upsert operations. The framework is designed for integration into Go applications, providing a unified interface for managing database connectivity and transactional integrity.
This is a full-featured Object-Relational Mapper that abstracts database interactions through entity mapping, which is the specific overhead the visitor is looking to avoid by requesting a standalone query builder.
pq is a PostgreSQL driver for Go that implements the standard database/sql interface. It serves as a connection library and protocol implementation that translates application data types into the binary and text formats required by PostgreSQL. The project provides specialized utilities for high-performance data ingestion using bulk data loading and a dedicated bulk data importer. It also features an implementation for listening to asynchronous server notifications and provides tools for connection load balancing across multiple hosts and ports. The driver covers a broad surface of database interaction, including parameterized query execution, prepared statements, and type mapping for arrays and timezones. Security is handled through SSL/TLS encryption, GSSAPI authentication, and utilities for escaping SQL identifiers and literals to prevent injection. Additional capabilities include detailed diagnostic error handling and raw protocol communication debugging.
This repository is a low-level database driver for PostgreSQL rather than a query builder, meaning it handles raw connection and protocol communication instead of providing a fluent API for programmatic SQL construction.
linq2db is a type-safe object-relational mapper that translates LINQ expressions into optimized SQL queries for multiple database providers. It functions as a database mapper that links classes to tables and includes a SQL query builder and a command-line schema tool for generating data classes from existing databases. The project provides high-performance bulk data processing for inserting and loading large volumes of records via batch or binary copy methods. It also supports advanced SQL operations, including window functions, common table expressions for recursive hierarchical querying, and dataset merging. The library covers a broad range of data manipulation and query execution capabilities, including optimistic locking, query result pagination, and many-to-many navigation translation. It also includes systems for connection lifecycle management, transaction atomicity, and database operation interception.
This library provides a robust fluent API for generating SQL queries and supports parameterized execution, though it is primarily designed as an ORM rather than a standalone query builder.