prep for 2.5.1090

This commit is contained in:
Sean Corfield 2023-10-28 14:04:35 -07:00
parent 737baa9d0e
commit 1fe526a734
10 changed files with 24 additions and 23 deletions

View file

@ -1,6 +1,6 @@
# 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 [#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.

View file

@ -4,8 +4,8 @@ SQL as Clojure data structures. Build queries programmatically -- even at runtim
## Build
[![Clojars](https://img.shields.io/badge/clojars-com.github.seancorfield/honeysql_2.4.1078-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABjFBMVEUAAAAdCh0qDikdChwAAAAnDSY0EjM2FjUnDiYnDSYnDSYpDigyEDEEAQRGNUb///////8mDSYAAAAAAAAAAAAFAgUqEyoAAAAAAAAAAAAFAgUAAABXU1c2FjVMx+dQx+f///////9Nx+b////4/f6y4vRPt+RQtOT///9Qt+P///8oDSey4vRQr9/////3/P5hzelNx+dNx+dNx+f///8AAAAuDy0zETIAAAAoDScAAAAAAAARBREAAAAvDy40ETMwEC9gSF+Ne42ilKKuoK6Rg5B5ZXlaP1o4Gzf///9nTWZ4YncyEDF/bn/8/Pz9/P339/c1FTUlDCRRM1AbCRtlS2QyEDEuDy1gRWAxEDAzETIwEC/g4OAvDy40EjOaiZorDiq9sbzNyM3UzdQyEDE0ETMzETKflZ/UzdQ5Fzmu4fNYyuhNx+dPt+RLu9xQyOhBbo81GTuW2vCo4PJNx+c4MFE5N1lHiLFEhKQyEDGDboMzETI5Fjh5bXje2d57aHrIw8jc2NyWhJUrDioxe9o4AAAAPnRSTlMAkf+IAQj9+e7n6e31RtqAD/QAAAED+A0ZEQ8DwvkLBsmcR4aG8+cdAD6C8/MC94eP+qoTrgH+/wj1HA8eEvpXOCUAAAABYktHRA8YugDZAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wcHFjou4Z/shwAAAUpJREFUOMul0/VTwzAUB/AAwyW4y3B3h8EDNuTh7u6UDHcd8I+TbHSjWdrjju/1h77kc+3Lu5aQvyakF/r6B5wu1+DQMEBomLRtG0EpozYDCEccA4iIjIqOiY0bB5iYxHgZ4FQCpYneKmmal0aQPMOXZnUAvJhLkbpInf8NFtKCTrGImK6DJcTlDGl/BXGV6oCsrSNIYAM3aQDwl2xJYBtBB5lZAuyYgWzY3YMcNcjN2wc4EGMEFTg8+hlyfgEenygAj71Q9FBExH0wKC4p1bRTJlJWXqEAVNM05ovbXfkPAHBmAUQPAGaAsXMBLiwA8z3h0gRcsWsObuAWLJu8Awb3ZoB5T8EvS/CgBo9Y5Z8TPwXBJwlUI9Ia/yRrEZ8lID71Olrf0MiamkkL4kurDEjba+C/e2sninR0wrsH8eMTvrqIWbodjh7jyjdtCY3Aniz4jwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNS0wNy0wN1QyMjo1ODo0NiswMjowMCgWtSoAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTUtMDctMDdUMjI6NTg6NDYrMDI6MDBZSw2WAAAAAElFTkSuQmCC)](https://clojars.org/com.github.seancorfield/honeysql)
[![cljdoc](https://cljdoc.org/badge/com.github.seancorfield/honeysql?2.4.1078)](https://cljdoc.org/d/com.github.seancorfield/honeysql/CURRENT)
[![Clojars](https://img.shields.io/badge/clojars-com.github.seancorfield/honeysql_2.5.1090-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAC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iwA8z3h0gRcsWsObuAWLJu8Awb3ZoB5T8EvS/CgBo9Y5Z8TPwXBJwlUI9Ia/yRrEZ8lID71Olrf0MiamkkL4kurDEjba+C/e2sninR0wrsH8eMTvrqIWbodjh7jyjdtCY3Aniz4jwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNS0wNy0wN1QyMjo1ODo0NiswMjowMCgWtSoAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTUtMDctMDdUMjI6NTg6NDYrMDI6MDBZSw2WAAAAAElFTkSuQmCC)](https://clojars.org/com.github.seancorfield/honeysql)
[![cljdoc](https://cljdoc.org/badge/com.github.seancorfield/honeysql?2.5.1090)](https://cljdoc.org/d/com.github.seancorfield/honeysql/CURRENT)
[![Slack](https://img.shields.io/badge/slack-HoneySQL-orange.svg?logo=slack)](https://clojurians.slack.com/app_redirect?channel=honeysql)
[![Join Slack](https://img.shields.io/badge/slack-join_clojurians-orange.svg?logo=slack)](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
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),
`: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
(-> (select :foo.a)

View file

@ -509,7 +509,7 @@ name reference.
`: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:
```clojure

View file

@ -7,7 +7,7 @@ databases.
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
* `:mysql` -- which includes MariaDB and Percona
* `:nrql` -- as of 2.4.next
* `:nrql` -- as of 2.5.1090
* `:oracle`
* `:sqlserver` -- Microsoft SQL Server

View file

@ -63,7 +63,7 @@ Supported Clojure versions: 1.7 and later.
In `deps.edn`:
<!-- :test-doc-blocks/skip -->
```clojure
com.github.seancorfield/honeysql {:mvn/version "2.4.1078"}
com.github.seancorfield/honeysql {:mvn/version "2.5.1090"}
```
Required as:

View file

@ -182,7 +182,7 @@ _New in HoneySQL 2.3.x_
The built-in dialects that HoneySQL supports are:
* `: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`
* `: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
* `:sqlserver` -- quotes SQL entity names with brackets, like `[this]`

View file

@ -10,14 +10,14 @@ For the Clojure CLI, add the following dependency to your `deps.edn` file:
<!-- :test-doc-blocks/skip -->
```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:
<!-- :test-doc-blocks/skip -->
```clojure
[com.github.seancorfield/honeysql "2.4.1078"]
[com.github.seancorfield/honeysql "2.5.1090"]
```
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
* `:sqlserver` -- Microsoft SQL Server
* `:mysql` -- MySQL (and Percona and MariaDB)
* `:nrql` -- as of 2.4.next
* `:nrql` -- as of 2.5.1090
* `:oracle` -- Oracle
The most visible difference between dialects is how SQL entities

View file

@ -1,6 +1,6 @@
# 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
helper functions) are supported:

View file

@ -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%');
```
As of 2.4.next, HoneySQL supports this syntax directly:
As of 2.5.1090, HoneySQL supports this syntax directly:
```clojure
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%')"]
```
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:
```clojure

View file

@ -55,11 +55,12 @@
;; implementation helpers:
(defn- default-merge [current args]
(let [current (cond
(let [mdata (meta current)
current (cond
(nil? current) []
(sequential? current) (vec current)
:else [current])]
(c/into current args)))
(c/into (with-meta current mdata) args)))
(defn- conjunction?
[e]
@ -143,7 +144,7 @@
(assoc data k' clause)
data)
:else
(clojure.core/update data k' default-merge args))))
(c/update data k' default-merge args))))
(defn- generic [k args]
(if (map? (first args))
@ -1158,9 +1159,9 @@
;; ensure #295 stays true (all public functions have docstring):
(assert (empty? (->> (ns-publics *ns*) (vals) (c/filter (comp not :doc meta))))))
;; 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
:upsert
: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))))))