This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-19
Channels
- # announcements (13)
- # asami (43)
- # babashka (35)
- # beginners (175)
- # calva (23)
- # cider (5)
- # clj-kondo (68)
- # cljsrn (4)
- # clojure (61)
- # clojure-australia (7)
- # clojure-europe (20)
- # clojure-gamedev (59)
- # clojure-israel (11)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-norway (21)
- # clojure-spec (12)
- # clojure-uk (43)
- # clojurescript (9)
- # cursive (56)
- # data-oriented-programming (5)
- # datascript (1)
- # events (1)
- # fulcro (16)
- # honeysql (46)
- # leiningen (1)
- # malli (4)
- # off-topic (12)
- # pathom (46)
- # re-frame (24)
- # reagent (14)
- # reitit (1)
- # reveal (8)
- # rewrite-clj (16)
- # ring (13)
- # sci (9)
- # spacemacs (14)
- # specter (2)
- # sql (2)
- # tools-deps (1)
- # vim (2)
Morning, I am looking for an example of how to add an as
alias to a subquery?
user=> (sql/format {:with [[:query {:select [:foo] :from [:bar]}]]})
["WITH query AS (SELECT foo FROM bar)"]
Thx @dharrigan @borkdude. I think that {:with …}
example might work but thru trial and error I found this worked:
{:select [:sub.id]
:from
[[{:select [:id :name1 :name2]]
:from [:table1]
:modifiers [:distinct-on :name1 :name2]
:order-by [:name1 :name2]} :sub]]}
Suitably anonymised table names and columns plus sub query is simplified.Sorry, the video wasn't related to your question, I just posted it here because it was about honeysql
Information is good, more information is better!
I need to look at babashka as I think it may solve a bunch of issues with observability and debugging in my current client.
Hi there. Quick question about using HoneySQL/next.jdbc: Is there a nice or recommended way to handle conversion between dashes and underscores in keywords? There's :allow-dashed-names true but that's just allowing HoneySQL to include dashes in the formatted string. Thanks in advance.
In my code, I use dashes for keywords, i.e., tenant-id
, that will automatically convert to tenant_id
on the rendered SQL that goes out to the db.
I actually showed that in the video earlier today and wondered where this was done. Later I saw this is in the format.clj namespace
I recommend using v2 (the alpha one): it has cool new features, like passing in maps as values
Yes, I agree. If you're starting off on something new 🙂 I don't think it'll be that long before 2.0.0 Alpha2 becomes a beta, then a final 🙂
I've converted my applications to use honeysql v2 (on branches atm) works wonderfully well.
I think that's already available in the current version? At least that's what the doc is telling me:
(-> (insert-into :properties)
(values [{:name "John" :surname "Smith" :age 34}
{:name "Andrew" :surname "Cooper" :age 12}
{:name "Jane" :surname "Daniels" :age 56}])
sql/format)
@seancorfield would it be possible for honeysqlv2 support create/edit/drop materialized view
? which is the same as create view
for postgresql?
I would replace this (-> (sql/raw (str "refresh materialized view " view " with data"))
Sure, create a GH issue so I don't forget.
Quick Q @dharrigan Is create view
different from create materialized view
?
Ah, yes, different syntax. So many options.