Fork me on GitHub
#honeysql
<
2022-10-21
>
k3nj1g06:10:03

Hello. Is there any way to add filter to windos function? Something like:

{:select [[[:over
               [[:count :fact_2]
                {:partition-by [:p]
                 :filter       {:where [:is-not :fact_2 nil]}}
                :stage_2_count]]]]}

seancorfield18:10:42

Create a GH issue and I'll take a look at adding support for that.

ivana13:10:14

Hello! format returns ["FROM heron.heron_file hf WHERE hf.external_file_id = ?" 33] May I get just raw string, i.e. "FROM heron.heron_file hf WHERE hf.external_file_id = 33" somehow, with already substituted all the ? by param values?

Pragyan Tripathi14:10:21

You need to pass options parameter :inline true

👍 1
1
ivana14:10:59

Thanks alot!

👍 1
seancorfield18:10:32

Just be aware of security issues here -- only use :inline true when you are guaranteed that all parameters are under your control and are validated! If you want to inline just one known-safe value, wrap it in [:inline 33] (and then you don't need :inline true as an option). The docs have warnings about security and :inline.

1
ivana21:10:04

Thanks, didn't know. Anyway I tried to solve some problems with version 1 and tried to write my own helpers & wrappers for it. But finally I found, yhat version 2 works also with some bugs, but much better than 1 and may be extended in a custom way without inlining parameters.

seancorfield21:10:30

@U0A6H3MFT The docs are also substantially better for v2 🙂

👍 2