This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-21
Channels
- # aws (1)
- # aws-lambda (1)
- # beginners (27)
- # boot (16)
- # cider (1)
- # clara (54)
- # cljs-dev (4)
- # cljsjs (8)
- # cljsrn (25)
- # clojure (148)
- # clojure-dev (2)
- # clojure-finland (1)
- # clojure-france (18)
- # clojure-italy (10)
- # clojure-nl (3)
- # clojure-russia (27)
- # clojure-sg (2)
- # clojure-uk (17)
- # clojurebridge (6)
- # clojurescript (70)
- # core-async (1)
- # css (6)
- # cursive (35)
- # data-science (3)
- # datomic (22)
- # events (4)
- # jobs (18)
- # jobs-discuss (14)
- # leiningen (4)
- # lumo (22)
- # off-topic (20)
- # om (5)
- # om-next (1)
- # onyx (47)
- # pedestal (107)
- # re-frame (43)
- # reagent (1)
- # ring (2)
- # ring-swagger (2)
- # rum (18)
- # sql (15)
- # unrepl (4)
- # vim (61)
- # yada (3)
does anyone know how to do functions with multiple arguments in honeysql in the edn representation? trying to get group_concat
specifically which takes a separator and field
{:select [:pair :%count.pair]
:from [[{:select [:name
[[:%GROUP_CONCAT.name,x] :B]]
:from [:order_items]
:group-by [:order_id]}]]
:group-by [:pair]}
@owen if you use the helper function call
instead off the :%...
form, you can do it: (honeysql/call :group_concat :name x)
the EDN only form of that translates out to #honeysql/call [:foo :bar]
, which requires the reader to have access to the reffed namespace
and is not something I would recommend relying on, because now you're dependent on making sure the reader loads namespaces like you expect when interpretting edn...which is something that I've always just found difficult and avoid
hmm I'm kindof constrained to using the pure edn version, we are definining hundreds of queries within a .edn
file used by analysts to no clojure
I think I found a way using the defmethod/fn-handler
though to write my own interpretation of GROUP_CONCAT
any reason you can't just write the raw SQL queries with ?
forms for args?
You can always be explicit about the tag literal readers you require when reading edn
fwiw
Maybe even s/can/should/
this is the first point where there's something I cant seem to get honeysql to generate for me
(edn/read-string {:readers {'sql/call honeysql.types/read-sql-call}} s)
or similar should do you if you like the #sql/call
reader literal