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
It seems like there is a bug where changes to the TTL string do not cause the table to be altered in ClickHouse.
Repro:
Init ClickHouse with the default tutor-contrib-aspects plugin settings.
Run show create table xapi.xapi_events_all_parsed;
You should see a line like TTL toDateTime(emission_time) + INTERVAL 1 YEAR
Change the setting ASPECTS_DATA_TTL_EXPRESSION to toDateTime(emission_time) + INTERVAL 5 YEAR in your env/config.yml or local Tutor plugin
tutor config save
tutor local do dbt
Wait a minute or two, depending on whether you're running a local ClickHouse or Cloud (Cloud takes a minute to run the DDL on all nodes)
Run show create table xapi.xapi_events_all_parsed;
You should see no changes- it will always be 1 year no matter how long you wait
The real fix is probably somewhere in dbt-clickhouse, but we should first pursue a short-term fix in this repo.
Proposed fix:
Write a macro that will execute an ALTER TABLE ... MODIFY TTL if the setting is not empty or ALTER TABLE ... REMOVE TTL` if the setting is an empty string
Add the macro as a post_hook on all models that have the TTL setting in their config block, remove the existing TTL setting reference
tutor local do dbt -- only_changed defaults to True
19:02:36 Up to date!
Running dbt run
Requested to only run modified state, checking for /app/aspects/dbt_state//manifest.json
Found /app/aspects/dbt_state//manifest.json so only running modified items and their downstreams
19:02:37 Running with dbt=1.7.13
It seems like there is a bug where changes to the TTL string do not cause the table to be altered in ClickHouse.
Repro:
show create table xapi.xapi_events_all_parsed;
TTL toDateTime(emission_time) + INTERVAL 1 YEAR
ASPECTS_DATA_TTL_EXPRESSION
totoDateTime(emission_time) + INTERVAL 5 YEAR
in yourenv/config.yml
or local Tutor plugintutor config save
tutor local do dbt
show create table xapi.xapi_events_all_parsed;
The real fix is probably somewhere in dbt-clickhouse, but we should first pursue a short-term fix in this repo.
Proposed fix:
ALTER TABLE ... MODIFY TTL
if the setting is not empty or ALTER TABLE ... REMOVE TTL` if the setting is an empty stringRelated docs:
https://clickhouse.com/docs/en/sql-reference/statements/alter/ttl#modify-ttl
https://docs.getdbt.com/reference/resource-configs/pre-hook-post-hook
The text was updated successfully, but these errors were encountered: