This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-03
Channels
- # announcements (21)
- # aws (6)
- # babashka (28)
- # beginners (39)
- # biff (1)
- # calva (23)
- # cider (5)
- # clj-kondo (108)
- # clojure (11)
- # clojure-europe (17)
- # clojure-nl (2)
- # clojure-nlp (10)
- # clojure-uk (8)
- # clojurescript (29)
- # community-development (4)
- # conjure (20)
- # css (3)
- # datalevin (9)
- # datomic (3)
- # events (2)
- # figwheel-main (11)
- # fulcro (36)
- # honeysql (7)
- # humbleui (5)
- # interceptors (4)
- # introduce-yourself (3)
- # jobs (1)
- # lsp (51)
- # malli (1)
- # meander (71)
- # minecraft (8)
- # other-languages (18)
- # pathom (15)
- # polylith (25)
- # portal (10)
- # re-frame (5)
- # reitit (15)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (11)
- # tools-deps (27)
Hi, is it possible to alias a clause with named columns? My closest attempt is this:
(hsql/format {:select [:nums.tens :nums.ones]
:from [[{:values [[1,10] [2,20]]} [:nums [:ones :tens]]]]})
=actual> "SELECT nums.tens, nums.ones FROM (VALUES (1, 10), (2, 20)) nums ones tens"
=desire> "SELECT nums.tens, nums.ones FROM (VALUES (1, 10), (2, 20)) nums(ones, tens)"
Is this what you're trying to achieve?
dev=> (hsql/format {:select [:nums.tens :nums.ones]
#_=> :from [[{:values [[1,10] [2,20]]} [:nums [:composite :ones :tens]]]]})
["SELECT nums.tens, nums.ones FROM (VALUES (?, ?), (?, ?)) AS nums (ones, tens)" 1 10 2 20]
(HoneySQL 2.x -- :composite
does not exist in 1.x I don't think)
You can use 2.x and 1.x side-by-side, even in the same namespace, so you could add 2.x and use it just for this one query 🙂
We are using a mix of 1.x and 2.x at work so we can migrate one query at a time if we need to.