Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: change dbt run to not drop model by default #21

Merged
merged 4 commits into from
Dec 22, 2023
Merged
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
6 changes: 3 additions & 3 deletions dbt/include/risingwave/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@
{% endmacro %}

{% macro risingwave__create_view_as(relation, sql) -%}
create view {{ relation }} as (
create view if not exists {{ relation }} as (
{{ sql }}
);
{%- endmacro %}

{% macro risingwave__create_table_as(relation, sql) -%}
create table {{ relation }} as (
create table if not exists {{ relation }} as (
{{ sql }}
);
{%- endmacro %}

{% macro risingwave__create_materialized_view_as(relation, sql) -%}
create materialized view {{ relation }} as (
create materialized view if not exists {{ relation }} as (
{{ sql }}
);
{%- endmacro %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% materialization materializedview, adapter='risingwave' %}
{%- set identifier = model['alias'] -%}
{%- set full_refresh_mode = should_full_refresh() -%}
{%- set old_relation = adapter.get_relation(identifier=identifier,
schema=schema,
database=database) -%}
Expand All @@ -8,7 +9,7 @@
database=database,
type='materializedview') -%}

{% if old_relation %}
{% if full_refresh_mode and old_relation %}
{{ adapter.drop_relation(old_relation) }}
{% endif %}

Expand Down
3 changes: 2 additions & 1 deletion dbt/include/risingwave/macros/materializations/table.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% materialization table, adapter='risingwave' %}
{%- set identifier = model['alias'] -%}
{%- set full_refresh_mode = should_full_refresh() -%}
{%- set old_relation = adapter.get_relation(identifier=identifier,
schema=schema,
database=database) -%}
Expand All @@ -8,7 +9,7 @@
database=database,
type='table') -%}

{% if old_relation %}
{% if full_refresh_mode and old_relation %}
{{ adapter.drop_relation(old_relation) }}
{% endif %}

Expand Down
3 changes: 2 additions & 1 deletion dbt/include/risingwave/macros/materializations/view.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% materialization view, adapter='risingwave' %}
{%- set identifier = model['alias'] -%}
{%- set full_refresh_mode = should_full_refresh() -%}
{%- set old_relation = adapter.get_relation(identifier=identifier,
schema=schema,
database=database) -%}
Expand All @@ -8,7 +9,7 @@
database=database,
type='view') -%}

{% if old_relation %}
{% if full_refresh_mode and old_relation %}
{{ adapter.drop_relation(old_relation) }}
{% endif %}

Expand Down