Skip to content

Commit dbd9673

Browse files
committed
fix incremental model
1 parent 24b2ae3 commit dbd9673

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

models/dbt_template_incremental_model.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
, alias = 'incremental_model'
1010
, materialized = 'incremental'
1111
, incremental_strategy = 'merge'
12-
, unique_key = ['block_number']
13-
, incremental_predicates = ["DBT_INTERNAL_DEST.block_date >= now() - interval '1' hour"]
12+
, unique_key = ['block_number', 'block_date']
13+
, incremental_predicates = ["DBT_INTERNAL_DEST.block_date >= now() - interval '1' day"]
1414
, on_table_exists = 'replace'
1515
)
1616
}}
@@ -24,9 +24,9 @@ from
2424
where
2525
1 = 1
2626
{%- if is_incremental() %}
27-
AND block_date >= now() - interval '1' hour -- on incremental runs, we only want to process the last hour of data
27+
AND block_date >= now() - interval '1' day -- on incremental runs, we only want to process the last day of data
2828
{%- else %}
29-
AND block_date >= now() - interval '1' day -- on full refresh runs, we want to process all data (to expedite, keep one day's worth of data)
29+
AND block_date >= now() - interval '7' day -- on full refresh runs, we want to process all data (to expedite, keep one week's worth of data)
3030
{%- endif %}
3131
group by
3232
block_number

0 commit comments

Comments
 (0)