oracle / dbt-oracle

dbt (data build tool) adapter for Oracle Autonomous Database
https://docs.getdbt.com/docs/core/connect-data-platform/oracle-setup
Apache License 2.0
45 stars 17 forks source link

[Bug] quoting database not working after upgrade to dbt-oracle >= 1.8.0 #153

Open Joul1285 opened 2 weeks ago

Joul1285 commented 2 weeks ago

Is there an existing issue for this?

Current Behavior

Hello, With dbt-oracle 1.7.x I was using this flag in my dbt_project.yml

quoting:
  database: false

However, with the release of version 1.8.x, it seems that we now need to specify the "database" value in the profiles.yml file. I have attempted to provide the value in both lowercase and uppercase, but so far, I haven't achieved the desired result.

Additionally, I have tried various combinations of quoting properties, as shown below:

quoting:
  database: false/true
  identifier: false/true
  schema: false/true

When attempting to build a model, DBT raised the following error:

Compilation Error in model my_model (models/my_model.sql)
  When searching for a relation, dbt found an approximate match. Instead of guessing
  which relation to use, dbt will move on. Please delete MY_SCHEMA.MY_MODEL, or rename it to be less ambiguous.
  Searched for: MY_SCHEMA.MY_MODEL
  Found: MY_SCHEMA.MY_MODEL

Despite this error, the model was successfully built in the database.

Furthermore, I noticed that if I do not provide the "database" value in the profiles.yml file, I receive a warning during each run, but no error on run.

Has anyone else encountered this issue? Any insights or suggestions would be greatly appreciated.

Expected Behavior

No response

Steps To Reproduce

No response

Relevant log output using --debug flag enabled

No response

Environment

- dbt-core: 1.8.1
- dbt-oracle: 1.8.1

What Oracle database version are you using dbt with?

19c

Additional Context

select SYS_CONTEXT('userenv', 'DB_NAME') from dual; Return my database name in lowercase.

aosingh commented 1 week ago

@Joul1285

Could you enable quoting only for the database and let me know how it goes ?

quoting:
  database: true
Joul1285 commented 1 week ago

@Joul1285

Could you enable quoting only for the database and let me know how it goes ?

quoting:
  database: true

Hello @aosingh ,

With the configuration you mentioned I still have the same warning or error messages.

If I don't reference my database target in profile.yml, I have this warning message, but no error at the end:

oracle adapter: [WARNING]: database key is missing from the target profile in the file profiles.yml 
 Starting with dbt-oracle 1.8  database name is needed for catalog generation
 Without database key in the target profile the generated catalog will be empty
 i.e. `dbt docs generate` command will generate an empty catalog json
 Make the following entry in dbt profile.yml file for the target profile
 database: mydatabasename

If I reference my database target in lowercase in profile.yml, I have this error:

When searching for a relation, dbt found an approximate match. Instead of guessing
  which relation to use, dbt will move on. Please delete MYSCHEMA.mymodel, or rename it to be less ambiguous.
  Searched for: MYSCHEMA.MYMODEL
  Found: MYSCHEMA.mymodel

Another try, if I reference my database target in uppercase in profile.yml, I have this error:

When searching for a relation, dbt found an approximate match. Instead of guessing
  which relation to use, dbt will move on. Please delete MYSCHEMA.MYMODEL, or rename it to be less ambiguous.
  Searched for: MYSCHEMA.MYMODEL
  Found: MYSCHEMA.MYMODEL

Thank you for your help.

aosingh commented 21 hours ago

@Joul1285

I want to confirm, have you tried the 2 together i.e. ?

Joul1285 commented 13 hours ago

@Joul1285

I want to confirm, have you tried the 2 together i.e. ?

  • Enable quoting only for database
  • Reference database in lowercase in profile.yml ?

Yes I did, I have the same error as mentioned before.