2.6.1203 -- 2024-10-22
2.6.1196 -- 2024-10-06
honey.sql.helpers
ns docstring.VALUES ROW(..)
syntax.register-clause!
and adding the example from the README to Extending HoneySQL.mod
from list of infix operators.2.6.1161 -- 2024-08-29
honey.sql/*escape-?*
which can be bound to false
to prevent ?
being escaped to ??
when used as an operator or function.format-var
in DDL, instead of format-entity
.2.6.1147 -- 2024-06-12
:composite
; fix bug in set-dialect!
where clause order is not restored.:using-gin
to :create-index
.:join
special syntax to support aliases and to handle expressions the same way select
/ from
etc handle them (extra [...]
nesting).DO UPDATE SET
with EXCLUDED
and regular SQL expressions.lift
-ed JSON expressions are used in the DSL.2.6.1126 -- 2024-03-04
{:nest ..}
in :union
clause reference docs.:from
and :join
clauses to provide index hints (SQL Server).:inline
works, to support a sequence of arguments.formatv
macro (.clj
only!) -- and removing the experimental formatf
function (added for discussion in 2.4.1045).CREATE INDEX
#348 via PR #517 @dancek.:not-in
explicitly in the documentation.clj-kondo
.2.5.1103 -- 2023-12-03
:quoted-always
option allows users to specify a regex that matches entities that should always be quoted (stropped) regardless of the value of :quoted
(such as reserved words that you have used as column or table names).:file
, :line
, :column
, :end-line
, and :end-column
metadata keys (previously only :line
and :column
were ignored),:ignored-metadata
option to allow additional keys to be ignored.2.5.1091 -- 2023-10-28
:array
special syntax (for BigQuery and PostgreSQL). This also adds support for metadata on the :select
value to produce AS STRUCT
or DISTINCT
.CREATE OR REPLACE
.ident?
before checking keyword/symbol.2.4.1078 -- 2023-10-07
:cast
in Special Syntax.:at-time-zone
special syntax.:distinct
and :expr
clauses to allow expressions to be qualified with SQL clauses. The latter will probably be useful for other dialects too.tools.build
to 0.9.6 (and get rid of template/pom.xml
in favor of new :pom-data
option to b/write-pom
).2.4.1066 -- 2023-08-27
:select
with function call and alias example to README (PR #502 @markbastian).INSERT INTO
(and REPLACE INTO
) use the :columns
or :values
clauses to produce column names (which are then omitted from those other clauses).:alias
special syntax.:overriding-value
option to :insert
clause.FROM
in SQL Clause Reference).[:only :table]
producing ONLY(table)
.:create-or-replace-view
to support PostgreSQL's lack of IF NOT EXISTS
for CREATE VIEW
.:values
clause when used to produce column names.tools.build
to 0.9.5 (and remove :java-opts
setting from build/run-task
)2.4.1045 -- 2023-06-25
formatf
function -- note: this was removed in 2.6.1126, in favor of the formatv
macro.:on-conflict
instead of just entities.:values
in CTEs (using :with
).:update
.honey.sql.helpers
namespace docstring (by adding a note from the relevant Getting Started section).2.4.1033 -- 2023-05-22
on-conflict
helper docstring #490 @holyjak.2.4.1026 -- 2023-04-15
INTERVAL
syntax.:with-ordinality
"operator".TABLE
to TRUNCATE
.:join
syntax to produce nested JOIN
expressions.tools.build
; split alias :test
/:runner
for friendlier jack-in UX while developing.2.4.1011 -- 2023-03-23
2.4.1006 -- 2023-03-17
:do-update-set
correctly in the upsert
helper and by handling parameters correctly in the :do-update-set
formatter.:raw
, essentially restoring 1.x functionality (while still allowing for embedded vectors as expressions, introduced in 2.x).2.4.1002 -- 2023-03-03
[:and]
as TRUE
and [:or]
as FALSE
.:order-by
special syntax via PR #468 @p-himik.:array
via PR #469 @p-himik.:quoted nil
via PR #475 @nharsch.2.4.980 -- 2023-02-15
+
, -
, and ~
(bitwise negation).2.4.979 -- 2023-02-11
2.4.972 -- 2023-02-02
format
to handle expressions (like 1.x could) as well as statements. This should aid with migration from 1.x to 2.x.2.4.969 -- 2023-01-14
-
to be variadic.:replace-into
to the core SQL supported, instead of just for the MySQL and SQLite dialects (so the latter is not needed yet).:nest
produces the desired result.CREATE TABLE
docs.2.4.962 -- 2022-12-17
set-options!
(only :checking
worked in 2.4.947).:cast
formatting when quoting is enabled, via PR #443 duddlf23. This changes how type names containing -
are formatted in a cast. See cast
Special Syntax for more details.:replace-into
to in-flight clause order (as well as registering it for the :mysql
dialect).:'ARRAY
.WITH
syntax, via PR #432, @MawiraIke. [Technically, this was in 2.4.947, but I kept the issue open while I wordsmithed the documentation]:numbered
option, which can also be set globally using set-options!
.2.4.947 -- 2022-11-05
TRUNCATE
.CREATE TEMP TABLE
etc.WHERE false
differed between the DSL and the where
helper.:'
as introducing a name that should be treated literally and not formatted as a SQL entity (which respects quoting, dot-splitting, etc); this effectively expands the "escape hatch" introduced via #352 in 2.2.868. Note that the function context behavior formats as a SQL entity, rather than the usual SQL "keyword", whereas this new context is a literal transcription rather than as a SQL entity!set-options!
.ADD COLUMN
, ALTER COLUMN
, DROP COLUMN
, and MODIFY COLUMN
.2.3.928 -- 2022-09-04
INTERVAL
as special syntax may be MySQL-specific and PostgreSQL uses difference syntax (because INTERVAL
is a data type there).DEFAULT
values and DEFAULT
rows in VALUES
.:quoted
(and :dialect
) are not specified, making HoneySQL more secure by default.:replace-into
for :mysql
dialect.honey.sql.protocols
and InlineValue
with a sqlize
function.WHERE
clause for DELETE
, DELETE FROM
, and UPDATE
when :checking :basic
(or :checking :strict
).WITH
/ (NOT
) MATERIALIZED
-- via PR #420 @robhanlon22.2.3.911 -- 2022-07-29
IN
expressions (a change from HoneySQL 1.x).ORDER BY
with a CASE
expression.:alter-column
(which produces MODIFY COLUMN
when the MySQL dialect is selected) and deprecating :modify-column
.register-dialect!
and get-dialect
, and also making add-clause-before
, strop
, and upper-case
public so that new dialects are easier to construct.2.2.891 -- 2022-04-23
ARRAY
constructor syntax and how to produce it.:array
and also improving the exception that was thrown when it was misused.:insert-into
table.:table
clause.RETURNING
clauses in docs and tests.honey.sql.pg-ops
namespace that registers PostgreSQL JSON and regex operators and provides symbolic names for "unwritable" operators (that contain @
, #
, or ~
).IN ()
expression, using a named parameter for the IN
values.build-clj
to v0.8.0.2.2.868 -- 2022-02-21
2.2.861 -- 2022-01-30
2.2.858 -- 2022-01-20
honey.sql/map=
to convert a hash map into an equality condition (for a WHERE
clause).:cache
option to honey.sql/format
(for Clojure only, not ClojureScript).SELECT * EXCEPT ..
and SELECT * REPLACE ..
and ARRAY<>
and STRUCT<>
column types -- see SQL Clause Reference - SELECT and SQL Clause Reference - DDL respectively for more details.build-clj
to v0.6.7.2.2.840 -- 2021-12-23
:nest
statement.:is
/ :is-not
-- this changes the behavior of [:is-not :col true/false]
to be correct and include NULL
values. Using :is
/ :is-not
with values that are not Boolean and not nil
will produce invalid SQL.build-clj
to v0.6.5.2.1.833 -- 2021-12-03
:select-distinct-on
differently.SELECT
and several other clauses, when :checking :basic
(or :strict
) is provided.build-clj
to v0.6.0.2.1.829 -- 2021-11-27
NOT
as a nested expression (so it is parenthesized unless it is a simple value).:nest
.honey.sql.helpers
namespace pointing out that all helper functions are variadic, they are all [& args]
, some have :arglists
metadata to provide a more specific usage hint but those all omit the optional first argument (the DSL hash map).DROP COLUMN IF EXISTS
/ ADD COLUMN IF NOT EXISTS
.build-clj
to v0.5.5.2.1.818 -- 2021-10-04
IS NULL
/ IS NOT NULL
tests.:values-default-columns
option to control whether missing columns are treated as NULL
or DEFAULT
in :values
clauses with sequences of hash maps.UNION
, EXCEPT
, etc were incorrectly parenthesized.build-clj
to v0.5.0.2.0.813 -- 2021-09-25
@
.:inline
syntax with the :inline true
option. A side effect of this is that [:inline [:param :foo]]
will now (correctly) inline the value of the parameter :foo
whereas it previously produced PARAMS SOURCE
. In addition, inlining has been extended to vector values, so [:inline ["a" "b" "c"]]
will now produce ('a', 'b', 'c')
and [:inline [:lift ["a" "b" "c"]]]
will now produce ['a', 'b', 'c']
which is what people seemed to expect (the behavior was previously unspecified).:create-table
.:quoted
argument to set-dialect!
.:add-index
.AS
aliasing in DELETE FROM
.readme
to test-doc-blocks
so all documentation is tested!2.0.783 -- 2021-08-15 (a.k.a "2.0 Gold")
SET
clause for the :mysql
dialect only; the behavior is unchanged for all other dialects.-
should retain the hyphen without special cases.:fetch
, :lift
, :limit
, :offset
, :param
, :select
; also around JSON/PostgreSQL.tools.build
for running tests and JAR building etc.2.0.0-rc5 (for testing; 2021-07-17)
OFFSET n ROWS
(or ROW
if n
is 1) if :fetch
is present or :sqlserver
dialect is specified; and by producing FETCH NEXT n ROWS ONLY
(or ROW
is n
is 1; or FIRST
instead of NEXT
if :offset
is not present).clojure.test
even for ClojureScript.:cross-join
documentation.fetch
helper (it previously returned an :offset
clause).with-columns
helper.2.0.0-rc3 (for testing; 2021-06-16)
:distinct
as special syntax, affecting an expression.&&
array operator.SELECT
a function expression (in Getting Started).test-runner
.2.0.0-rc2 (for testing; 2021-05-10)
ON
/USING
to be optional and not dropping parameters on the floor.%
function call syntax respect :quoted true
and/or :dialect
options, and also allowing for qualified column names. (PR from @lognush):quoted-snake true
option to force conversion from kebab-case to snake_case when :quoted true
or a :dialect
is specified to format
.test-runner
.2.0.0-rc1 (for testing; 2021-05-06)
insert-into
supports merging into another statement in all cases.:on-conflict
.:checking
mode. Currently only detects potential problems with IN
clauses.2.0.0-beta2 (for testing; 2021-04-13)
WHERE
/HAVING
merge logic. Important bug fix!FILTER
, WITHIN GROUP
, and ORDER BY
(as an expression), from nilenso/honeysql-postgres 0.4.112. These are Special Syntax and there are also helpers for filter
and within-group
-- so be careful about referring in all of honey.sql.helpers
since it will now shadow clojure.core/filter
(it already shadows for
, group-by
, into
, partition-by
, set
, and update
).join-by
(and correcting the helper docstring).2.0.0-beta1 (for testing; 2021-04-09)
where
/having
is broken in Beta 1!register-clause!
is idempotent.:set
clauses (just like we do with :insert
columns). Note that you can still use explicit dotted names if you want table qualification.;
(to avoid SQL injection risks).:raw
as a clause. There is no helper function equivalent (because it would be ambiguous whether you meant a function form -- [:raw ..]
-- or a clause form -- {:raw ..}
; and for the same reason, there is no nest
helper function since that also works as a clause and as a function/special syntax).2.0.0-alpha3 (for early testing; 2021-03-13)
com.github.seancorfield/honeysql
(although new versions will continue to be deployed to seancorfield/honeysql
for a while -- see the Clojars Verified Group Names policy).CREATE
/DROP
statements in general, including columns, TABLESPACE
, CASCADE
, WITH [NO] DATA
, etc.CREATE TABLE .. AS ..
.ON DUPLICATE KEY UPDATE
.CREATE
/DROP
/REFRESH
on MATERIALIZED VIEW
.SELECT .. INTO ..
and SELECT .. BULK COLLECT INTO ..
.SELECT TOP
and OFFSET
/FETCH
.LATERAL
(as special syntax, with a helper).where
behavior with recent 1.x changes (porting #283 to 2.x).:escape
as special syntax for regular expression patterns.:join-by
/join-by
so that you can have multiple JOIN
's in a specific order.2.0.0-alpha2 (for early testing)
honey.sql.helpers
.2.0.0-alpha1 (for early testing)
honey.sql
-- this is the primary API via the format
function as well as the various extension points.honey.sql.helpers
-- provides a helper function for every piece of the DSL that is supported out-of-the-box.com.github.seancorfield/honeysql
so it can be added to a project that already uses HoneySQL 1.x without any conflicts, making it easier to migrate piecemeal from 1.x to 2.x.1.0.461 -- 2021-02-22
merge-where
(and merge-having
) behavior. #282 via #283 (@camsaul)1.0.444 -- 2020-05-29
cross-join
/ merge-cross-join
/ :cross-join
. (@dcj)deps.edn
instead of Leiningen. Also add CI vi both CircleCI and GitHub Actions.next.jdbc
everywhere clojure.java.jdbc
was mentioned.0.9.10 -- 2020-03-06
except
. (@ted-coakley-otm)false
as well. (@ted-coakley-otm)deps.edn
, also multi-version clj testing and new readme
testing.0.9.9 -- 2020-03-02
0.9.8 -- 2019-09-07
honeysql.format/*namespace-as-table?*
and :namespace-as-table?
option to format
. (@seancorfield)0.9.7 -- 2019-09-07
honeysql.format/*allow-namespaced-names?*
to restore the previous behavior. A :allow-namespaced-names?
option has been adding to format
to set this more easily. (@seancorfield)set0
(:set0
) and set1
(:set1
) variants of sset
(:set
) to support different placements of SET
(before FROM
or after JOIN
respectively) that different databases require. See also #200. (@seancorfield)composite
/:composite
constructor for values. (@seancorfield)columns
/merge-columns
and throwing an exception if a single collection is supplied (instead of varargs). (@seancorfield)truncate
support. (@seancorfield)select
in the README that column names can be keywords or symbols but not strings. (@seancorfield)0.9.6 -- 2019-09-24
nil
conditions out of where
/merge-where
. Fix #246. (@seancorfield)0.9.5 -- 2019-09-07
format-predicate
now accepts parameterizer
as a named argument (default :jdbc
) to match format
. PR #234. (@glittershark)0.9.4 -- 2018-10-01
#sql/inline nil
should produce NULL
. Fix #221. (@seancorfield)#sql/inline :kw
should produce "kw"
. Fix #224 via PR #225. (@vincent-dm) Note: this introduces a new protocol, Inlinable
, which controls inline value rendering, and changes the behavior of #sql/inline :foo/bar
to produce just "bar"
(where it was probably invalid SQL before).[:col :alias]
are now checked to have exactly two elements. Fix #226. (@seancorfield)where
and merge-where
to be given no predicates. Fix #228 and PR #230. (@seancorfield, @arichiardi)as
alias is no longer split during quoting. Fix #221 and PR #231. (@gws)Not all of these releases were tagged on GitHub and none of them have release notes on GitHub. Releases prior to 0.5.0 were not documented (although some were tagged on GitHub).
0.9.3
#sql/raw
. Fix #219. (@seancorfield)raw
and inline
to the README. Fix #213. (@seancorfield)register-parameterizer
for custom parameterizers. PR #209. (@juvenn)set
priority to after join
. Fix #200. (@michaelblume)join ... using( ... )
. Fix #188, PR #201. (@vincent-dm)run-tests.sh
to make it easier to run the same tests manually that run on Travis-CI. (@seancorfield)deps.edn
to support clj
/tools.deps.alpha
. (@seancorfield)#sql/inline
data reader. (@seancorfield)0.9.2
nil
:and
arguments for where. Fix #203. (@michaelblume)select
formatting. Fix #198. (@visibletrap)INSERT INTO ... QUERY
. (@emidln):parameterizer
:none
for skipping next.jdbc
or clojure.java.jdbc
parameter generation. (@arichiardi)0.9.1
0.9.0 --
:with
and :with-recursive
clauses (@enaeher)0.8.2
0.8.1
0.8.0
0.7.0
0.6.3
0.6.2
0.6.1
0.6.0
0.5.3
0.5.2
0.5.1
0.5.0
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close