honeysql

Ernesto Garcia 2023-08-29T08:48:49.248899Z

Not sure if there is a way in HoneySQL to write:

SELECT date AT TIME ZONE 'Europe/London', ...

p-himik 2023-08-29T09:05:24.941349Z

Nothing built-in but you can always use :raw or add your own formatter.

Ernesto Garcia 2023-08-29T09:05:53.655049Z

Yeah, I'm doing

(str (sql/format-entity :bank-transaction/date)
     " AT TIME ZONE "
     \' dates/*default-zone-id* \')

Ernesto Garcia 2023-08-29T09:07:13.340309Z

...into a :raw

p-himik 2023-08-29T09:16:43.125279Z

Yeah, that works. But you also don't need to call str, you can just use [:raw "str1" " str2 " "str3"]. Note the spaces though since :raw doesn't add them for you.

p-himik 2023-08-29T09:17:24.632459Z

But if you use AT TIME ZONE more than once, I'd recommend adding your own formatter/function/whatever might be more suitable. It's all well documented.

👍 1
1
seancorfield 2023-08-29T18:00:08.015699Z

Seems like this is fairly widely-supported SQL so I'll add it to core https://github.com/seancorfield/honeysql/issues/503 Looks like this is widely-enough supported that it ought to be in the core. Can you create a GitHub issue

👍 2