A Clojure library that turns data structures into SQL queries, enabling programmatic SQL generation without string concatenation.
HoneySQL is a Clojure library that converts Clojure data structures into SQL queries. It solves the problem of building SQL programmatically by providing a composable DSL, eliminating the need for error-prone string concatenation and enabling dynamic query construction at runtime.
Clojure and ClojureScript developers who need to generate SQL queries for databases, especially those using JDBC libraries like next.jdbc or clojure.java.jdbc and requiring dynamic or complex query building.
Developers choose HoneySQL for its pure data structure approach, which integrates naturally with Clojure, supports multiple SQL dialects, and allows for extensibility without runtime dependencies. Its helper functions and parameterization options make it both safe and flexible for production use.
Turn Clojure data structures into SQL
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Represents SQL queries as Clojure maps and vectors, making them composable and easy to manipulate programmatically, as shown with examples like {:select [:a :b :c] :from [:foo]}.
Supports ANSI, MySQL, Oracle, SQLServer, and NRQL dialects out-of-the-box, with vendor-specific extensions, enabling cross-database compatibility without code changes.
Generates SQL with positional (?) or numbered ($1) parameters to prevent SQL injection, seamlessly integrating with JDBC libraries like next.jdbc.
Allows registration of custom operators, functions, and SQL clauses via register-op! and register-fn!, supporting database-specific features without modifying core library.
HoneySQL is purely a SQL generation library and does not handle database connections or query execution, requiring additional dependencies like next.jdbc or clojure.java.jdbc.
Only usable within Clojure or ClojureScript projects, making it irrelevant for teams using other languages and adding a learning curve for non-Clojure developers.
The honey.sql.helpers namespace overwrites several clojure.core functions (e.g., distinct, filter), which can cause naming conflicts and require careful namespace management, as noted in the README.
Uses a MAJOR.MINOR.COMMITS version scheme that does not follow semantic versioning, potentially leading to breaking changes in minor updates and reduced predictability for upgrades.