Skip to content

Implement column level TTL configuration #437

Open
@davimi

Description

@davimi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions