You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Which packages are affected?
dbt-adapters
dbt-tests-adapter
dbt-athena
dbt-athena-community
dbt-bigquery
dbt-postgres
dbt-redshift
dbt-snowflake
dbt-spark
Current Behavior
I had an errant column in a table that was named ?column?, and dbt failed when trying to drop the column with the below error.
Database Error in model dim_date (models/marts/dim_date.sql)
syntax error at or near "?" in context "."dim_date" drop column ?", at line 3, column 65
This only happens on incremental models as far as I can tell since dbt does not drop and recreate the table.
I believe double quoting column names should fix this. I'm unable to test on other adapters but believe the same issue would occur.
Expected Behavior
dbt successfully drops all unused columns in a table regardless of their naming format by double quoting the column name.
Steps To Reproduce
Create an incremental model in dbt
Manually add a column named ?column? to the table with alter table my_model add column "?column?"
Run dbt run -s my_model
Relevant log output
In "prod"."dev_mc"."dim_date":
Schema changed: True
Source columns not in target: []
Target columns not in source: [Column(column='?column?', dtype='integer', char_size=None, numeric_precision=32, numeric_scale=0)]
New column types: []
...
[0m12:21:45.606694 [debug] [Thread-1 (]: On model.edw.dim_date: /* {"app": "dbt", "dbt_version": "1.9.2", "profile_name": "edw", "target_name": "prod", "node_id": "model.edw.dim_date"} */
alter table "prod"."dev_mc"."dim_date" drop column ?column?
[0m12:21:45.671261 [debug] [Thread-1 (]: Redshift adapter: Redshift error: syntax error at or near "?"in context "."dim_date" drop column ?", at line 3, column 65
Environment
- OS: MacOS 15.3.1
- Python: Python 3.10.12
- dbt-adapters:
Core:
- installed: 1.9.2
- latest: 1.9.2 - Up to date!
Plugins:
- redshift: 1.9.0 - Up to date!
- postgres: 1.9.0 - Up to date!
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Is this a new bug?
Which packages are affected?
Current Behavior
I had an errant column in a table that was named
?column?
, and dbt failed when trying to drop the column with the below error.This only happens on incremental models as far as I can tell since dbt does not drop and recreate the table.
I believe double quoting column names should fix this. I'm unable to test on other adapters but believe the same issue would occur.
Expected Behavior
dbt successfully drops all unused columns in a table regardless of their naming format by double quoting the column name.
Steps To Reproduce
?column?
to the table withalter table my_model add column "?column?"
dbt run -s my_model
Relevant log output
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: