Description
Is your feature request related to a problem? Please describe.
ClickHouse allows for TTL definitions on a per column level. See docs. The ClickHouse dbt adapter does not seem to support this yet. The only supported column configuration is codec
. ttl
Should be added as another column level configuration. This could be very useful to expire sensitive data earlier than the rest of the table's columns.
Describe the solution you'd like
It should be possible to define a TTL expression per column which is added to the table definition.
Example:
- name: username
data_type: String
ttl: toDateTime(event_time) + interval 1 day
This should result in the table definition SQL:
`username` String TTL toDateTime(event_time) + toIntervalDay(1),
Describe alternatives you've considered
Defining another model with lower table TTL: This can work in practice but defining multiple tables with the same content but different table TTL is impractical and increases data volume unnecessarily.
Additional context
The TTL expression should also work in combination with materialized views.