Comments (5)
Thanks to your comments I came to a safer workaround. Just ignore that especific exception:
{% macro oracle__drop_relation(relation) -%}
{% call statement('drop_relation', auto_begin=False) -%}
DECLARE
dne_942 EXCEPTION;
PRAGMA EXCEPTION_INIT(dne_942, -942);
attempted_ddl_on_in_use_GTT EXCEPTION;
pragma EXCEPTION_INIT(attempted_ddl_on_in_use_GTT, -14452);
identifier_too_long EXCEPTION;
PRAGMA EXCEPTION_INIT(identifier_too_long, -972);
BEGIN
SAVEPOINT start_transaction;
EXECUTE IMMEDIATE 'DROP {{ relation.type }} {{ relation }} cascade constraint';
COMMIT;
EXCEPTION
WHEN attempted_ddl_on_in_use_GTT THEN
NULL; -- if it its a global temporary table, leave it alone.
WHEN dne_942 THEN
NULL;
WHEN identifier_too_long THEN
NULL; -- object cannot actually exist anyway
END;
{%- endcall %}
{% endmacro %}
from dbt-oracle.
For any ORA-00972: identifier is too long
issue, if the database version is older than 12c there are 2 options:
- Use a shorter model alias
{{ config(alias='sessions') }}
- Have a macro override at dbt project level like we did in a similar issue
From Oracle 12c, identifiers can be 128 bytes long
I checked your macro override and I would be careful adding this check to a generic macro
{% if relation.type != "view" %}
The reason why we have <relation>__dbt_backup
, is to handle the case if the dbt model was a previously a table. dbt renames the old relation to <relation>__dbt_backup
and for that it drops any existing <relation>__dbt_backup
to avoid ORA-00955: name is already used by an existing object
from dbt-oracle.
Hi @aosingh thanks for the quick response. I'm using alias for the longest names, but a "__dbt_backup" suffix is 12 characters long. That means I only have 18 characters to use in my user facing view names.
Since this is internal dbt and temporary stuff, I think it'd be correct to truncate the names from the left to 30 characters for old db versions. The rollback mechanism should prevent those objects to be persisted in case of error.
Regarding my hack:
{% if relation.type != "view" %}
Thanks for the word of caution. I'm aware it's a little clunky, but it should work until I have some time to dig deeper into the code.
from dbt-oracle.
I discussed this internally, and as documented, the minimum supported Oracle Database version by dbt-oracle is 12c.
Starting with Oracle 12c, identifiers can be 128 bytes long and this should not be problem.
With Oracle 11g, let me know in case you encounter any ORA-00972: identifier is too long
issues. I can help suggest a workaround probably by overriding the macro at project level.
from dbt-oracle.
from dbt-oracle.
Related Issues (20)
- [Bug] Seed fails, if a column has no values HOT 4
- [Bug] Connection to PDB HOT 4
- Getting Error ORA-30926 when using snapshot functionality HOT 3
- [Bug] DBT is trying to create table for incremental model but it exists already HOT 3
- [Bug] dbt-oracle 1.4 bugfixes backport HOT 1
- upgrade to support dbt-core v1.7.0 HOT 1
- [Feature] Documenting quoting HOT 1
- [Bug] Have the client_identifier, model and action attributes logged on the `dbt.log` enabling maintenance of the respective sessions
- [Bug] Unsupported version of dbt-core installed using pip HOT 2
- [Bug] catalog.json is generated empty HOT 3
- [Feature] implement delete+insert incremental strategy HOT 2
- [Bug] table materialization fails when another MV with the same name exists in database HOT 5
- [Bug] Quoting Identifier True and Persist docs HOT 3
- [Bug] Oracle run_result.json has rows_affected = 0 always when data are inserted or updated into target table HOT 14
- [Feature] Option to purge table for table materializations HOT 1
- upgrade to support dbt-core v1.8.0
- [Feature] Remove dependency to Microsoft Visual C++ 14.0 HOT 2
- [Bug] Case sensitive names for Oracle HOT 5
- ORA-00955: name is already used by an existing object HOT 6
- Release support for 1.8 on PyPI HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbt-oracle.