Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
{% endif %}
{%- set inserts_only = config.get('inserts_only') -%}
{%- set grant_config = config.get('grants') -%}
{%- set has_contract = config.get('contract').enforced -%}
{%- set full_refresh_mode = (should_full_refresh() or existing_relation.is_view) -%}
{%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}

Expand Down Expand Up @@ -70,7 +71,7 @@
-- table. It is the user's responsibility to avoid duplicates. Note that "inserts_only" is a ClickHouse adapter
-- specific configurable that is used to avoid creating an expensive intermediate table.
{% call statement('main') %}
{{ clickhouse__insert_into(target_relation, sql) }}
{{ clickhouse__insert_into(target_relation, sql, has_contract) }}
{% endcall %}

{% else %}
Expand Down Expand Up @@ -99,7 +100,7 @@
{% do clickhouse__incremental_insert_overwrite(existing_relation, partition_by, True) %}
{% elif incremental_strategy == 'append' %}
{% call statement('main') %}
{{ clickhouse__insert_into(target_relation, sql) }}
{{ clickhouse__insert_into(target_relation, sql, has_contract) }}
{% endcall %}
{% endif %}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
{% endif %}
{%- set inserts_only = config.get('inserts_only') -%}
{%- set grant_config = config.get('grants') -%}
{%- set has_contract = config.get('contract').enforced -%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The has_contract variable assignment might fail if config.get('contract') returns None. Consider adding a null check similar to how it's done in the table materialization:

Suggested change
{%- set has_contract = config.get('contract').enforced -%}
{%- set has_contract = config.get('contract') is not none and config.get('contract').enforced -%}

{%- set full_refresh_mode = (should_full_refresh() or existing_relation.is_view) -%}
{%- set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') -%}

Expand Down Expand Up @@ -50,7 +51,7 @@
-- specific configurable that is used to avoid creating an expensive intermediate table.
-- insert_overwrite strategy does not require unique_key => is an exception.
{% call statement('main') %}
{{ clickhouse__insert_into(target_relation, sql) }}
{{ clickhouse__insert_into(target_relation, sql, has_contract) }}
{% endcall %}

{% else %}
Expand Down Expand Up @@ -81,7 +82,7 @@
{% do clickhouse__incremental_delete_insert(existing_relation, unique_key, incremental_predicates) %}
{% elif incremental_strategy == 'append' %}
{% call statement('main') %}
{{ clickhouse__insert_into(target_relation, sql) }}
{{ clickhouse__insert_into(target_relation, sql, has_contract) }}
{% endcall %}
{% elif incremental_strategy == 'insert_overwrite' %}
{% do clickhouse__incremental_insert_overwrite(existing_relation, partition_by, False) %}
Expand Down