Hi everyone,
I am encountering an issue with the dbt-oracle adapter (version 1.7.4) when trying to apply descriptions to columns that contain spaces and dashes in their names.
Even though I explicitly set quote: true in my schema.yml file, the adapter seems to ignore it when generating the COMMENT ON COLUMN statement. This results in an ORA-00905: missing keyword error from Oracle because the column name is not wrapped in double quotes in the compiled DDL.
Environment
- dbt Core: 1.7.4
- Adapter: dbt-oracle 1.7.4
- Database: Oracle
Steps to Reproduce
1. SQL Model (my_view.sql):
WITH my_cte AS (
SELECT
technical_id AS "My Column - ID",
user_code AS "My Column - Code"
FROM {{ ref('my_source_table') }}
)
SELECT * FROM my_cte
2. YAML Configuration (schema.yml):
version: 2
models:
- name: my_view
description: "My view"
columns:
- name: "My Column - ID"
quote: true
description: "Unique technical identifier"
data_type: VARCHAR2
- name: "My Column - Code"
quote: true
description: "Unique code associated with the entity"
data_type: VARCHAR2
The Error
The view itself is created successfully, but the run fails during the documentation phase with the following error:
oracle adapter: Oracle error: ORA-00905: missing keyword
ERROR creating sql view model MY_SCHEMA.MY_VIEW ......................... [ERROR in 0.15s]
If I look at the Oracle trace, the query generated by dbt to apply the comment looks like this:
comment on column MY_SCHEMA.MY_VIEW.My Column - ID is q'<Unique technical identifier>'
As you can see, the column name My Column - ID is not enclosed in double quotes, which causes Oracle to parse the words and the dash separately, triggering the ORA-00905 error. It should be generated as "My Column - ID".
Has anyone else encountered this issue? Is this a known bug in the dbt-oracle adapter regarding how quote: true is handled in the commenting macros?
Thanks in advance for your help!