@@ -84,16 +84,21 @@ valid_stg AS (
84
84
85
85
{%- endif %}
86
86
87
- {%- set is_incremental = automate_dv .is_any_incremental () %}
88
- {%- set use_valid_stg = is_incremental and apply_source_filter %}
89
- {%- set source_table = ' valid_stg AS sd' if use_valid_stg else ' source_data AS sd' %}
90
- {%- set hashdiff_alias = automate_dv .prefix ([src_hashdiff], ' sd' , alias_target= ' source' ) %}
91
- {%- set lag_default = automate_dv .cast_binary (' FFFFFFFF' , quote= true) %}
92
- {%- set partition_by = automate_dv .prefix ([src_pk], ' sd' , alias_target= ' source' ) %}
93
- {%- set order_by = automate_dv .prefix ([src_ldts], ' sd' , alias_target= ' source' ) %}
94
- {%- set order_by_eff = automate_dv .prefix ([src_eff], ' sd' , alias_target= ' source' ) %}
95
- {%- set is_bigquery = target .type == ' bigquery' %}
96
- {%- set use_eff = automate_dv .is_something ([src_eff]) %}
87
+ {%- set is_incremental = automate_dv .is_any_incremental () - %}
88
+ {%- set use_valid_stg = is_incremental and apply_source_filter - %}
89
+ {%- set source_table = ' valid_stg AS sd' if use_valid_stg else ' source_data AS sd' - %}
90
+ {%- set hashdiff_alias = automate_dv .prefix ([src_hashdiff], ' sd' , alias_target= ' source' ) - %}
91
+ {%- set lag_default = automate_dv .cast_binary (' FFFFFFFF' , quote= true) - %}
92
+ {%- set partition_by = automate_dv .prefix ([src_pk], ' sd' , alias_target= ' source' ) - %}
93
+ {%- set is_bigquery = target .type == ' bigquery' - %}
94
+ {%- set order_by = automate_dv .prefix ([src_ldts], ' sd' , alias_target= ' source' ) - %}
95
+
96
+ {%- set use_eff = automate_dv .is_something (src_eff) - %}
97
+
98
+ {%- if use_eff - %}
99
+ {%- set order_by_eff = automate_dv .prefix ([src_eff], ' sd' , alias_target= ' source' ) - %}
100
+ {%- endif - %}
101
+
97
102
{# - BigQuery does not support a 3-arg LAG() where the third arg is an expression, it must be a constant. Workaround below #}
98
103
99
104
unique_source_records AS (
0 commit comments