Skip to content

[Bug] don't drop temporary table o$pt #12

Closed
@AlexMorti

Description

@AlexMorti

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The global temporary table is not deleted after running the model due to an

[dbt-oracle/blob/main/dbt/include/oracle/macros/adapters.sql](

pragma EXCEPTION_INIT(attempted_ddl_on_in_use_GTT, -14452);
)

example:
create global temporary table TEST (object_id number, object_name varchar2(30)) on commit PRESERVE rows;

Such tables get bound to the session with the first insert and then this binding is ONLY removed when the session exits or by truncate. If the binding exists DDL cannot be performed on these temporary tables and if you try a DDL on such tables you would receive ORA-14452 attempt to create, alter or drop an index on temporary table already in use.

add before

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

Expected Behavior

drop table

Steps To Reproduce

  1. create model materialized='incremental'

Relevant log output using --debug flag enabled

No response

Environment

- OS:MacOs
- Python:3.9
- dbt-core: 1.1.0

What Oracle database version are you using dbt with?

12.1.0

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions