<@U088WCP3B4P> {{ elementary.null_timestamp() }} a...
# ask-elementary-ai
s
@kapa.ai {{ elementary.null_timestamp() }} as start_bucket_in_data from monitored_table ), where i should remove the comma in my macro itself there is no comma as start_bucket_in_data ?
k
A message from kapa.ai
You’re running into a known bug in the
column_anomalies
/ column monitoring query: when no
timestamp_column
is provided, the compiled SQL ends up with:
Copy code
sql select   <your_columns>,   {{ elementary.null_timestamp() }} as start_bucket_in_data, from monitored_table
Note the trailing comma before
from
, which causes a syntax error. [[Redshift syntax](https://github.com/elementary-data/elementary/issues/1540); [Databricks syntax](https://github.com/elementary-data/elementary/issues/1554)] That comma is not in your
{{ elementary.null_timestamp() }}
macro; it’s in the calling macro (
column_monitoring_query.sql
) right after
start_bucket_in_data
. The relevant line in the package looks like:
Copy code
sql {{ elementary.null_timestamp() }} as start_bucket_in_data,
So: - You do not need to change
null_timestamp()
itself. - The comma that needs to be removed is the one after
start_bucket_in_data
in the caller (
column_monitoring_query.sql
), in the branch that is used when
timestamp_column
is not configured. [[Databricks syntax](https://github.com/elementary-data/elementary/issues/1554)] Two workarounds until this is fixed in the package: 1. Add a
timestamp_column
in your test config so that the “else” branch (with the buggy comma) isn’t used. [[Slack Databricks thread](https://slack.com/archives/C02CTC89LAX/p1716306300184349)] 2. Locally patch the macro: copy
column_monitoring_query.sql
into your own project under
macros/
and remove the trailing comma after
start_bucket_in_data
in the “no timestamp” branch.