This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-01
Channels
- # adventofcode (77)
- # announcements (1)
- # architecture (6)
- # babashka (16)
- # beginners (28)
- # calva (2)
- # cider (5)
- # clj-kondo (28)
- # clojure (63)
- # clojure-europe (39)
- # clojure-nl (1)
- # clojure-norway (10)
- # clojure-uk (3)
- # clojurebridge (2)
- # clojurescript (23)
- # cursive (1)
- # datalevin (1)
- # dev-tooling (2)
- # emacs (16)
- # events (3)
- # fulcro (8)
- # guix (3)
- # honeysql (16)
- # introduce-yourself (1)
- # jobs (1)
- # joyride (91)
- # lambdaisland (1)
- # lsp (18)
- # membrane (1)
- # nbb (1)
- # off-topic (62)
- # pathom (4)
- # portal (11)
- # rdf (4)
- # re-frame (4)
- # releases (3)
- # shadow-cljs (55)
- # tools-deps (10)
- # xtdb (3)
- # yada (5)
Are there facilities to, er, query a HoneySQLv2 query map? For example, I want to check if a table is already left-joined. The function is trivial to write myself, but I was wondering if people tend to do this kind of thing.
I've had to also add facilities to join/filter/select using "dynamic" table names so that you would be able to do it more than once.
There are SQLisms that make this a difficult prospect in general - particularly aliases. But, if you ignore that, I have had good experience using #CFFTD7R6Z to parse through Honey data structures
I think that given honeysql has a somewhat well defined grammar, the SQLisms are not such big of a deal.
Grammar isn’t the issue but semantics are. For example:
{:with [[:cte {:select [:a] :from [:t]}]] :select [:a] :from [:s] :join [:cte]}
(edited to fix the syntax)Is :t
in the join?
Ah true. I’m not concerned with that though. I’m more interested in not writing functions to get the table names in the join clause.
Ah, ok. Then, I’ve had good experience using meander to parse and recursively descend into honey data structures. Meander makes it very straightforward.
I do love how honeysql makes this even possible. We’ve written some terrible looking code that “prunes” an SQL query based on what the API request is. Impossible with string based sql
Agreed!
@U7PBP4UVA That would be "trivial" if HoneySQL used sets for :join
clauses I think? The only problem would be that JOIN
order can be significant (which is why HoneySQL has a specific construct for ordering multiple JOIN
clauses as well). Or I guess the join-merging logic could always apply distinct
to the sequence of JOIN
s?
Feel free to create a GH issue if you think there's anything HoneySQL could do better in this area to help support your use case.