Skip to content

Commit

Permalink
Refresh the materialized_view table only if --full-refresh is speci…
Browse files Browse the repository at this point in the history
…fied (#288)
  • Loading branch information
the4thamigo-uk committed Jun 12, 2024
1 parent 9c212f2 commit 906fdd5
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@
{% call statement('drop existing materialized view') %}
drop view if exists {{ mv_relation }} {{ cluster_clause }}
{% endcall %}
{% call statement('main') -%}
{{ get_create_table_as_sql(False, backup_relation, sql) }}
{%- endcall %}
{% if should_full_refresh() %}
{% call statement('main') -%}
{{ get_create_table_as_sql(False, backup_relation, sql) }}
{%- endcall %}
{% do exchange_tables_atomic(backup_relation, existing_relation) %}
{% else %}
-- we need to have a 'main' statement
{% call statement('main') -%}
select 1
{%- endcall %}
{% endif %}
{% do exchange_tables_atomic(backup_relation, existing_relation) %}
{% call statement('create new materialized view') %}
{{ clickhouse__create_mv_sql(mv_relation, existing_relation, cluster_clause, sql) }}
Expand Down

0 comments on commit 906fdd5

Please sign in to comment.