honeysql

markaddleman 2024-07-11T12:39:51.169139Z

BigQuery has an WITH OFFSET AS syntax as part of its UNNEST function. https://cloud.google.com/bigquery/docs/arrays#flattening_arrays I didn’t quickly see HoneySQL support for this. Should I open an issue?

p-himik 2024-07-11T14:36:16.391889Z

FWIW it's very easy to extend HoneySQL to support whatever you want. In this case, you can either use register-clause! to register :with-offset or register-fn! to register a custom formatter for :unnest. The latter makes sense if you consider WITH OFFSET to be a part of the UNNEST function and not of the overall query.

markaddleman 2024-07-11T14:37:48.720189Z

Thanks I tried register-fn! and discovered that I misread the BQ syntax diagram. The WITH OFFSET is actually a part of the FROM clause (from honey’s point of view) but it turns out that the syntax is only available if the you use the UNNEST function

markaddleman 2024-07-11T14:39:11.942709Z

I got distracted by something else before I to register a custom clause fn