File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
dbt/include/oracle/macros Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 268268{% endmacro %}
269269
270270{% macro oracle__truncate_relation(relation) - %}
271- {% call statement(' truncate_relation' ) - %}
272- truncate table {{ relation .quote (schema= False, identifier= False) }}
273- {%- endcall %}
271+ {# -- To avoid `ORA-01702: a view is not appropriate here` we check that the relation to be truncated is a table #}
272+ {% if relation .is_table %}
273+ {% call statement(' truncate_relation' ) - %}
274+ truncate table {{ relation .quote (schema= False, identifier= False) }}
275+ {%- endcall %}
276+ {% endif %}
274277{% endmacro %}
275278
276279{% macro oracle__rename_relation(from_relation, to_relation) - %}
Original file line number Diff line number Diff line change 6262 {% do adapter .commit () %}
6363
6464 {% for rel in to_drop %}
65+ {% do adapter .truncate_relation (rel) %}
6566 {% do adapter .drop_relation (rel) %}
6667 {% endfor %}
6768
Original file line number Diff line number Diff line change 3535 {{ adapter .dispatch (' post_snapshot' )(staging_relation) }}
3636{% endmacro %}
3737
38- {% macro default__post_snapshot(staging_relation) %}
39- {# no-op #}
38+ {% macro oracle__post_snapshot(staging_relation) %}
39+ {% do adapter .truncate_relation (staging_relation) %}
40+ {% do adapter .drop_relation (staging_relation) %}
4041{% endmacro %}
4142
4243
You can’t perform that action at this time.
0 commit comments