Skip to content

Commit b2c1752

Browse files
committed
Add error handling when filter is not defined
1 parent 4a71ed5 commit b2c1752

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

macros/materializations/insert_by_period_materialization.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
{%- set stop_date = config.get('stop_date') or '' -%}}
4949
{%- set period = config.get('period') or 'week' -%}
5050

51+
{%- if not '__PERIOD_FILTER__' is in sql -%}
52+
{%- set error_message -%}
53+
Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql
54+
{%- endset -%}
55+
{{ exceptions.raise_compiler_error(error_message) }}
56+
{%- endif -%}
57+
5158
{%- set identifier = model['name'] -%}
5259

5360
{%- set existing_relations = adapter.list_relations(schema=schema) -%}

0 commit comments

Comments
 (0)