change tracking macro

This commit is contained in:
drethereum 2025-07-24 09:54:24 -06:00
parent 1a77ece09b
commit 10b69a211a
2 changed files with 11 additions and 8 deletions

View File

@ -74,14 +74,7 @@ models:
+enabled: true # enable subpackages, as needed
gold:
+enabled: true
+post-hook: >
{% if 'exclude_change_tracking' not in config.get('tags') %}
{% if config.get('materialized') == 'view' %}
ALTER VIEW {{ this }} SET CHANGE_TRACKING = TRUE;
{% else %}
ALTER TABLE {{ this }} SET CHANGE_TRACKING = TRUE;
{% endif %}
{% endif %}
+post-hook: "{{ enable_change_tracking() }}"
bronze:
+enabled: false
github_actions:
@ -133,6 +126,7 @@ vars:
HEAL_MODEL: False
HEAL_MODELS: []
STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES: False
ENABLE_CHANGE_TRACKING: False
#### STREAMLINE 2.0 BEGIN ####

View File

@ -0,0 +1,9 @@
{% macro enable_change_tracking() %}
{% if 'exclude_change_tracking' not in config.get('tags') and var('ENABLE_CHANGE_TRACKING', false) %}
{% if config.get('materialized') == 'view' %}
ALTER VIEW {{ this }} SET CHANGE_TRACKING = TRUE;
{% else %}
ALTER TABLE {{ this }} SET CHANGE_TRACKING = TRUE;
{% endif %}
{% endif %}
{% endmacro %}