Skip to content
Snippets Groups Projects
Commit 9a1ec133 authored by Cam Saül's avatar Cam Saül
Browse files

Upgrade HoneySQL :new:

parent e267f42b
Branches
Tags
No related merge requests found
......@@ -48,7 +48,7 @@
[compojure "1.5.1"] ; HTTP Routing library built on Ring
[environ "1.0.3"] ; easy environment management
[hiccup "1.0.5"] ; HTML templating
[honeysql "0.6.3"] ; Transform Clojure data structures to SQL (version 0.7.0+ makes CI fail -- probably need to fix something!)
[honeysql "0.7.0"] ; Transform Clojure data structures to SQL
[log4j/log4j "1.2.17" ; logging framework
:exclusions [javax.mail/mail
javax.jms/jms
......
......@@ -8,6 +8,7 @@
(alter-meta! #'honeysql.core/format assoc :style/indent 1)
(alter-meta! #'honeysql.core/call assoc :style/indent 1)
;; for some reason the metadata on these helper functions is wrong which causes Eastwood to fail, see https://github.com/jkk/honeysql/issues/123
(alter-meta! #'honeysql.helpers/merge-left-join assoc
:arglists '([m & clauses])
......@@ -25,6 +26,15 @@
(defmethod hformat/fn-handler "extract" [_ unit expr]
(str "extract(" (name unit) " from " (hformat/to-sql expr) ")"))
;; HoneySQL 0.7.0+ parameterizes numbers to fix issues with NaN and infinity -- see https://github.com/jkk/honeysql/pull/122.
;; However, this broke some of Metabase's behavior, specifically queries with calculated columns with numeric literals --
;; some SQL databases can't recognize that a calculated field in a SELECT clause and a GROUP BY clause is the same thing if the calculation involves parameters.
;; Go ahead an use the old behavior so we can keep our HoneySQL dependency up to date.
(extend-protocol honeysql.format/ToSql
java.lang.Number
(to-sql [x] (str x)))
;; HoneySQL automatically assumes that dots within keywords are used to separate schema / table / field / etc.
;; To handle weird situations where people actually put dots *within* a single identifier we'll replace those dots with lozenges,
;; let HoneySQL do its thing, then switch them back at the last second
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment