Fork me on GitHub
Jakub Holý (HolyJak)14:01:38

Hi! Is there a way to force (values [{:id 1, :valid true}]) to generate "... values(?,?)" instead of "... values(?,TRUE)" ? I have been reading the docs and code but could not figure it out 🙏


That's what :lift is for:

dev=> (sql/format (h/values [{:id 1 :value true}]))
["(id, value) VALUES (?, TRUE)" 1]
dev=> (sql/format (h/values [{:id 1 :value [:lift true]}]))
["(id, value) VALUES (?, ?)" 1 true]

🙏 1
Jakub Holý (HolyJak)19:01:10

Thanks a lot! I believed I saw something like that in the docs when I first read them but when I was searching them I obviously failed to find the right search terms / look at the right place 😔


Hey hello, does anybody knows if is possible to reproduce this in honeysql?

ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES addresses (address);


DDL is often very database-specific and hard to design a DSL for that works predictably so I'm open to adding support where there is ANSI-standard syntax but for a lot of DDL, it's just not worth going through HoneySQL, IMO.


Makes sense, thanks


I’m having a little trouble getting sql functions working with honeysql. Taking this example directly out of the readme:

(-> {:select [[[:max :id]]], :from [:foo]} sql/format)
I’m supposed to get ["SELECT MAX(id) FROM foo"] but instead I get an exception:
Execution error (AssertionError) at honeysql.format/seq->sql (format.cljc:385).
Assert failed: Alias should have two parts[[:max :id]]
Are the docs out of date; is there a newer way to call functions? EDIT: facepalm I’m using an older version of honeysql from before that syntax was introduced. Ignore me!