You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the return value of seq_get(args, 1) for a WEEK (or QUARTER or other date part) is an exp.Column, but WEEK(MONDAY) is an exp.Week (which of course doesn't have a name property). I hacked together the following custom dialect, which fixes the issue, but I'm guessing isn't going to cut it as a real fix:
I hacked around a little in bigquery.py to try and put together a PR but I wasn't able to quite figure out the right way to do it. I'm happy to contribute a PR if someone can point me in the right direction.
The text was updated successfully, but these errors were encountered:
I've tested this on the latest released version as well as on main and it is the same both places
Fully reproducible code snippet
Official Documentation
Here are the BigQuery docs for DATE_TRUNC showing
WEEK(WEEKDAY)
is a valid option: https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date_truncI believe this happens because at this point:
sqlglot/sqlglot/dialects/bigquery.py
Line 166 in fb819f0
seq_get(args, 1)
for aWEEK
(orQUARTER
or other date part) is anexp.Column
, butWEEK(MONDAY)
is anexp.Week
(which of course doesn't have aname
property). I hacked together the following custom dialect, which fixes the issue, but I'm guessing isn't going to cut it as a real fix:I hacked around a little in bigquery.py to try and put together a PR but I wasn't able to quite figure out the right way to do it. I'm happy to contribute a PR if someone can point me in the right direction.
The text was updated successfully, but these errors were encountered: