Fork me on GitHub
#honeysql
<
2022-09-07
>
Max15:09:15

Is there a way to set the honeysql checking mode globally you can for the dialect and quoting options?

seancorfield17:09:38

Not currently. Feel free to create a GH issue about it!

fabrao19:09:26

hello all, how do I convert this to helper?

{:with [[:ce {:insert-into  ...}
to:
(sqlh/with 
       (sqlh/insert-into ...)) ?

seancorfield19:09:13

Are you looking for this result?

user=> (-> (with [:ce (insert-into :table)]) (sql/format))
["WITH ce AS (INSERT INTO table)"]
user=>

fabrao19:09:24

thank you Sean, I'll try that

fabrao19:09:56

what is that [:ce stuff?

seancorfield20:09:39

I copied it from your code @U0YJJPFRA

{:with [[:ce {:insert-into  ...}
The :with clause takes a sequence of pairs as a value. The helper takes any number of pairs. That's typically how all helpers work.

fabrao20:09:55

oh ok. It's information for with and not an operator, I got it, thank you again

seancorfield20:09:24

It's like this:

user=> (-> (select :a [:b :c] [[:+ :d :e] :f]) (from :table) (sql/format))
["SELECT a, b AS c, d + e AS f FROM table"]
user=>

seancorfield20:09:59

Compare with the raw data structure:

user=> (-> (select :a [:b :c] [[:+ :d :e] :f]) (from :table))
{:select [:a [:b :c] [[:+ :d :e] :f]], :from [:table]}
user=>

fabrao20:09:40

yes, undertood