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
dbt-oracle 1.3.1 problem "oracle adapter: Oracle error: ORA-00972: identifier is too long" on dbt snapshot #62
Comments
Hi @gbonazzoli Could you run the dbt snapshot command with
I think from version 12.2 SQL identifiers can be 128 bytes long Also, could you let me know the dbt snapshot strategy ( |
Hi @aosingh You can find the debug file attached to the present message. The strategy is:
|
Hi, I'm getting the same error when trying to materialize an incremental model, It looks like the assigned names for when creating temporary tables are too long now. example with 1.3.0: create global temporary table o$pt_(model name)132935 example with 1.3.1: create global temporary table o$pt_(model name)133255833329 |
@Mirko-T @gbonazzoli This will be an issue with older versions of Oracle Databases. I think from version 12.2 SQL identifiers can be 128 bytes long To resolve this, include the following macro in your dbt project. {% macro oracle__make_temp_relation(base_relation, suffix) %}
{% set dt = modules.datetime.datetime.now() %}
{% set dtstring = dt.strftime("%H%M%S") %}
{% set tmp_identifier = 'o$pt_' ~ base_relation.identifier ~ dtstring %}
{% set tmp_relation = base_relation.incorporate(
path={"identifier": tmp_identifier, "schema": None}) -%}
{% do return(tmp_relation) %}
{% endmacro %} |
@aosingh It works! What I have done is: In every dbt project, I have created a file named Do you think the "Oracle identifier's length problem" will be directly fixed in a future version of the oracle adapter ? |
Starting from database version 12.2 the identifiers can be 128 bytes long and hence the identifier length will not be problem. You do not need the macro override for newer Database versions (12.2, 18c, 19c, 21c). The macro override is only needed for older versions (11.2.0.4 in this case). |
@aosingh this same problem was fixed upstream for PostgreSQL (dbt-labs/dbt-core#2869). Do you think a similar fix could be officially included on the Oracle adapter too? I understand we are talking about very old Oracle versions, but it's an annoying limitation. I was putting cryptic alias for all my materializations until I found this issue. |
Btw, my particular case is when using views. It seems like at some point a backup view is created and then deleted:
|
Is there an existing issue for this?
Current Behavior
Same project:
dbt-oracle 1.3.0 Works fine
root@new-airflow-dbt:~/airflow/dags/SALES_ORDERS_MANAGEMENT/snapshots# dbt snapshot
05:43:33 oracle adapter: Running in cx mode
05:43:33 Running with dbt=1.3.1
05:43:33 Found 1 model, 0 tests, 3 snapshots, 0 analyses, 325 macros, 2 operations, 0 seed files, 15 sources, 0 exposures, 0 metrics
05:43:33
05:43:34
05:43:34 Running 1 on-run-start hook
05:43:34 1 of 1 START hook: dbt_project.on-run-start.0 .................................. [RUN]
05:43:34 1 of 1 OK hook: dbt_project.on-run-start.0 ..................................... [OK in 0.00s]
05:43:34
05:43:34 Concurrency: 8 threads (target='prod')
05:43:34
05:43:34 1 of 3 START snapshot psofa.sales_orders ....................................... [RUN]
05:43:34 2 of 3 START snapshot psofa.sales_orders_appog ................................. [RUN]
05:43:34 3 of 3 START snapshot psofa.uniters_orders ..................................... [RUN]
05:43:34 oracle adapter: Oracle error: ORA-00972: identificativo troppo lungo
05:43:34 3 of 3 ERROR snapshotting psofa.uniters_orders ................................. [ERROR in 0.46s]
05:43:35 oracle adapter: Oracle error: ORA-00972: identificativo troppo lungo
05:43:35 2 of 3 ERROR snapshotting psofa.sales_orders_appog ............................. [ERROR in 0.84s]
05:43:39 1 of 3 OK snapshotted psofa.sales_orders ....................................... [OK in 4.96s]
05:43:39
05:43:39 Running 1 on-run-end hook
05:43:39 1 of 1 START hook: dbt_project.on-run-end.0 .................................... [RUN]
05:43:39 1 of 1 OK hook: dbt_project.on-run-end.0 ....................................... [OK in 0.00s]
05:43:39
05:43:39
05:43:39 Finished running 3 snapshots, 2 hooks in 0 hours 0 minutes and 5.84 seconds (5.84s).
05:43:39
05:43:39 Completed with 2 errors and 0 warnings:
05:43:39
05:43:39 Database Error in snapshot uniters_orders (snapshots/uniters_orders.sql)
05:43:39 ORA-00972: identificativo troppo lungo
05:43:39
05:43:39 Database Error in snapshot sales_orders_appog (snapshots/sales_orders_appog.sql)
05:43:39 ORA-00972: identificativo troppo lungo
05:43:39
05:43:39 Done. PASS=1 WARN=0 ERROR=2 SKIP=0 TOTAL=3```
Expected Behavior
It is logical to expect the same behaviour.
Steps To Reproduce
Relevant log output using
--debug
flag enabledEnvironment
What Oracle database version are you using dbt with?
11.2.0.4
Additional Context
No response
The text was updated successfully, but these errors were encountered: