Skip to content

Fix/clean global temporary table #13

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

Merged
merged 2 commits into from
Jun 3, 2022
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
9 changes: 6 additions & 3 deletions dbt/include/oracle/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,12 @@
{% endmacro %}

{% macro oracle__truncate_relation(relation) -%}
{% call statement('truncate_relation') -%}
truncate table {{ relation.quote(schema=False, identifier=False) }}
{%- endcall %}
{#-- To avoid `ORA-01702: a view is not appropriate here` we check that the relation to be truncated is a table #}
{% if relation.is_table %}
{% call statement('truncate_relation') -%}
truncate table {{ relation.quote(schema=False, identifier=False) }}
{%- endcall %}
{% endif %}
{% endmacro %}

{% macro oracle__rename_relation(from_relation, to_relation) -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
{% do adapter.commit() %}

{% for rel in to_drop %}
{% do adapter.truncate_relation(rel) %}
{% do adapter.drop_relation(rel) %}
{% endfor %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
{{ adapter.dispatch('post_snapshot')(staging_relation) }}
{% endmacro %}

{% macro default__post_snapshot(staging_relation) %}
{# no-op #}
{% macro oracle__post_snapshot(staging_relation) %}
{% do adapter.truncate_relation(staging_relation) %}
{% do adapter.drop_relation(staging_relation) %}
{% endmacro %}


Expand Down