prep for 2.5.1090
This commit is contained in:
parent
737baa9d0e
commit
1fe526a734
10 changed files with 24 additions and 23 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
* 2.4.next in progress
|
* 2.5.1090 -- 2023-10-28
|
||||||
* Address [#512](https://github.com/seancorfield/honeysql/issues/512) by adding support for subqueries in the `:array` special syntax (for BigQuery and PostgreSQL). This also adds support for metadata on the `:select` value to produce `AS STRUCT` or `DISTINCT`.
|
* Address [#512](https://github.com/seancorfield/honeysql/issues/512) by adding support for subqueries in the `:array` special syntax (for BigQuery and PostgreSQL). This also adds support for metadata on the `:select` value to produce `AS STRUCT` or `DISTINCT`.
|
||||||
* Address [#511](https://github.com/seancorfield/honeysql/issues/511) by adding support for BigQuery `CREATE OR REPLACE`.
|
* Address [#511](https://github.com/seancorfield/honeysql/issues/511) by adding support for BigQuery `CREATE OR REPLACE`.
|
||||||
* Address [#510](https://github.com/seancorfield/honeysql/issues/510) by adding initial support for an NRQL dialect.
|
* Address [#510](https://github.com/seancorfield/honeysql/issues/510) by adding initial support for an NRQL dialect.
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ SQL as Clojure data structures. Build queries programmatically -- even at runtim
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
[](https://clojars.org/com.github.seancorfield/honeysql)
|
[](https://clojars.org/com.github.seancorfield/honeysql)
|
||||||
[](https://cljdoc.org/d/com.github.seancorfield/honeysql/CURRENT)
|
[](https://cljdoc.org/d/com.github.seancorfield/honeysql/CURRENT)
|
||||||
[](https://clojurians.slack.com/app_redirect?channel=honeysql)
|
[](https://clojurians.slack.com/app_redirect?channel=honeysql)
|
||||||
[](http://clojurians.net)
|
[](http://clojurians.net)
|
||||||
|
|
||||||
|
|
@ -759,7 +759,7 @@ be quoted according to the selected dialect. If you override the dialect in a
|
||||||
`format` call, by passing the `:dialect` option, SQL entity names will be automatically
|
`format` call, by passing the `:dialect` option, SQL entity names will be automatically
|
||||||
quoted. You can override the dialect and turn off quoting by passing `:quoted false`.
|
quoted. You can override the dialect and turn off quoting by passing `:quoted false`.
|
||||||
Valid `:dialect` options are `:ansi` (the default, use this for PostgreSQL),
|
Valid `:dialect` options are `:ansi` (the default, use this for PostgreSQL),
|
||||||
`:mysql`, `:oracle`, or `:sqlserver`. As of 2.4.next, `:nrql` is also supported:
|
`:mysql`, `:oracle`, or `:sqlserver`. As of 2.5.1090, `:nrql` is also supported:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
(-> (select :foo.a)
|
(-> (select :foo.a)
|
||||||
|
|
|
||||||
|
|
@ -509,7 +509,7 @@ name reference.
|
||||||
|
|
||||||
`:select-distinct` works the same way but produces `SELECT DISTINCT`.
|
`:select-distinct` works the same way but produces `SELECT DISTINCT`.
|
||||||
|
|
||||||
As of 2.4.next, you can use metadata on the argument to `:select` to
|
As of 2.5.1090, you can use metadata on the argument to `:select` to
|
||||||
provide qualifiers for the `SELECT` clause:
|
provide qualifiers for the `SELECT` clause:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ databases.
|
||||||
As a reminder, HoneySQL supports the following dialects out of the box:
|
As a reminder, HoneySQL supports the following dialects out of the box:
|
||||||
* `:ansi` -- which is the default and provides broad support for PostgreSQL as well
|
* `:ansi` -- which is the default and provides broad support for PostgreSQL as well
|
||||||
* `:mysql` -- which includes MariaDB and Percona
|
* `:mysql` -- which includes MariaDB and Percona
|
||||||
* `:nrql` -- as of 2.4.next
|
* `:nrql` -- as of 2.5.1090
|
||||||
* `:oracle`
|
* `:oracle`
|
||||||
* `:sqlserver` -- Microsoft SQL Server
|
* `:sqlserver` -- Microsoft SQL Server
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ Supported Clojure versions: 1.7 and later.
|
||||||
In `deps.edn`:
|
In `deps.edn`:
|
||||||
<!-- :test-doc-blocks/skip -->
|
<!-- :test-doc-blocks/skip -->
|
||||||
```clojure
|
```clojure
|
||||||
com.github.seancorfield/honeysql {:mvn/version "2.4.1078"}
|
com.github.seancorfield/honeysql {:mvn/version "2.5.1090"}
|
||||||
```
|
```
|
||||||
|
|
||||||
Required as:
|
Required as:
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ _New in HoneySQL 2.3.x_
|
||||||
The built-in dialects that HoneySQL supports are:
|
The built-in dialects that HoneySQL supports are:
|
||||||
* `:ansi` -- the default, that quotes SQL entity names with double-quotes, like `"this"`
|
* `:ansi` -- the default, that quotes SQL entity names with double-quotes, like `"this"`
|
||||||
* `:mysql` -- quotes SQL entity names with backticks, and changes the precedence of `SET` in `UPDATE`
|
* `:mysql` -- quotes SQL entity names with backticks, and changes the precedence of `SET` in `UPDATE`
|
||||||
* `:nrql` -- as of 2.4.next, see [New Relic NRQL Support](nrsql.md) for more details of the NRQL dialect
|
* `:nrql` -- as of 2.5.1090, see [New Relic NRQL Support](nrsql.md) for more details of the NRQL dialect
|
||||||
* `:oracle` -- quotes SQL entity names like `:ansi`, and does not use `AS` in aliases
|
* `:oracle` -- quotes SQL entity names like `:ansi`, and does not use `AS` in aliases
|
||||||
* `:sqlserver` -- quotes SQL entity names with brackets, like `[this]`
|
* `:sqlserver` -- quotes SQL entity names with brackets, like `[this]`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,14 @@ For the Clojure CLI, add the following dependency to your `deps.edn` file:
|
||||||
|
|
||||||
<!-- :test-doc-blocks/skip -->
|
<!-- :test-doc-blocks/skip -->
|
||||||
```clojure
|
```clojure
|
||||||
com.github.seancorfield/honeysql {:mvn/version "2.4.1078"}
|
com.github.seancorfield/honeysql {:mvn/version "2.5.1090"}
|
||||||
```
|
```
|
||||||
|
|
||||||
For Leiningen, add the following dependency to your `project.clj` file:
|
For Leiningen, add the following dependency to your `project.clj` file:
|
||||||
|
|
||||||
<!-- :test-doc-blocks/skip -->
|
<!-- :test-doc-blocks/skip -->
|
||||||
```clojure
|
```clojure
|
||||||
[com.github.seancorfield/honeysql "2.4.1078"]
|
[com.github.seancorfield/honeysql "2.5.1090"]
|
||||||
```
|
```
|
||||||
|
|
||||||
HoneySQL produces SQL statements but does not execute them.
|
HoneySQL produces SQL statements but does not execute them.
|
||||||
|
|
@ -341,7 +341,7 @@ The dialects supported by HoneySQL 2.x are:
|
||||||
* `:ansi` -- the default, including most PostgreSQL extensions
|
* `:ansi` -- the default, including most PostgreSQL extensions
|
||||||
* `:sqlserver` -- Microsoft SQL Server
|
* `:sqlserver` -- Microsoft SQL Server
|
||||||
* `:mysql` -- MySQL (and Percona and MariaDB)
|
* `:mysql` -- MySQL (and Percona and MariaDB)
|
||||||
* `:nrql` -- as of 2.4.next
|
* `:nrql` -- as of 2.5.1090
|
||||||
* `:oracle` -- Oracle
|
* `:oracle` -- Oracle
|
||||||
|
|
||||||
The most visible difference between dialects is how SQL entities
|
The most visible difference between dialects is how SQL entities
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# New Relic NRQL Support
|
# New Relic NRQL Support
|
||||||
|
|
||||||
As of 2.4.next, HoneySQL provides some support for New Relic's NRQL query language.
|
As of 2.5.1090, HoneySQL provides some support for New Relic's NRQL query language.
|
||||||
|
|
||||||
At present, the following additional SQL clauses (and their corresponding
|
At present, the following additional SQL clauses (and their corresponding
|
||||||
helper functions) are supported:
|
helper functions) are supported:
|
||||||
|
|
|
||||||
|
|
@ -50,14 +50,14 @@ PostgreSQL also has an "array constructor" for creating arrays from subquery res
|
||||||
SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');
|
SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');
|
||||||
```
|
```
|
||||||
|
|
||||||
As of 2.4.next, HoneySQL supports this syntax directly:
|
As of 2.5.1090, HoneySQL supports this syntax directly:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
user=> (sql/format {:select [[[:array {:select :oid :from :pg_proc :where [:like :proname [:inline "bytea%"]]}]]]})
|
user=> (sql/format {:select [[[:array {:select :oid :from :pg_proc :where [:like :proname [:inline "bytea%"]]}]]]})
|
||||||
["SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%')"]
|
["SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%')"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Prior to 2.4.next, you had to use HoneySQL's "as-is" function syntax to circumvent
|
Prior to 2.5.1090, you had to use HoneySQL's "as-is" function syntax to circumvent
|
||||||
the special syntax:
|
the special syntax:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,12 @@
|
||||||
;; implementation helpers:
|
;; implementation helpers:
|
||||||
|
|
||||||
(defn- default-merge [current args]
|
(defn- default-merge [current args]
|
||||||
(let [current (cond
|
(let [mdata (meta current)
|
||||||
|
current (cond
|
||||||
(nil? current) []
|
(nil? current) []
|
||||||
(sequential? current) (vec current)
|
(sequential? current) (vec current)
|
||||||
:else [current])]
|
:else [current])]
|
||||||
(c/into current args)))
|
(c/into (with-meta current mdata) args)))
|
||||||
|
|
||||||
(defn- conjunction?
|
(defn- conjunction?
|
||||||
[e]
|
[e]
|
||||||
|
|
@ -143,7 +144,7 @@
|
||||||
(assoc data k' clause)
|
(assoc data k' clause)
|
||||||
data)
|
data)
|
||||||
:else
|
:else
|
||||||
(clojure.core/update data k' default-merge args))))
|
(c/update data k' default-merge args))))
|
||||||
|
|
||||||
(defn- generic [k args]
|
(defn- generic [k args]
|
||||||
(if (map? (first args))
|
(if (map? (first args))
|
||||||
|
|
@ -1158,9 +1159,9 @@
|
||||||
;; ensure #295 stays true (all public functions have docstring):
|
;; ensure #295 stays true (all public functions have docstring):
|
||||||
(assert (empty? (->> (ns-publics *ns*) (vals) (c/filter (comp not :doc meta))))))
|
(assert (empty? (->> (ns-publics *ns*) (vals) (c/filter (comp not :doc meta))))))
|
||||||
;; ensure all public functions match clauses:
|
;; ensure all public functions match clauses:
|
||||||
(assert (= (clojure.core/set (conj @#'honey.sql/default-clause-order
|
(assert (= (c/set (conj @#'honey.sql/default-clause-order
|
||||||
:composite :filter :lateral :over :within-group
|
:composite :filter :lateral :over :within-group
|
||||||
:upsert
|
:upsert
|
||||||
:generic-helper-variadic :generic-helper-unary))
|
:generic-helper-variadic :generic-helper-unary))
|
||||||
(clojure.core/set (conj (map keyword (keys (ns-publics *ns*)))
|
(c/set (conj (map keyword (keys (ns-publics *ns*)))
|
||||||
:nest :raw))))))
|
:nest :raw))))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue