dbt-snowflake
dbt-snowflake copied to clipboard
[Bug] Incorrect column order in view after successful job run
Is this a new bug in dbt-snowflake?
- [X] I believe this is a new bug in dbt-snowflake
- [X] I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
hi all! I have a customer that is experiencing incorrect column order in their Cloud jobs which is causing errors. They've reported to Snowflake and they in turn identified a possible issue with the way we create the view/table. Currently, they're seeing a SELECT *
during the create or replace.
Seeing {% set model_columns = model.columns %}
here: https://github.com/dbt-labs/dbt-snowflake/blob/3fbc0749491f40d34014336457753b140e1fb1ee/dbt/include/snowflake/macros/relations/view/create.sql#L13
They're on versionless and on Snowflake. I've been unable to reproduce the issue with a similar source table and ref'd model.
Expected Behavior
Columns in order as per the table/view structure or query updates.
Steps To Reproduce
- Create source table with 10+ columns.
- CTE A to ref the source and CTE B transform in int model to have SELECT * FROM CTE A returned and excluding one of the columns.
- add CTE C to select * from CTE B with 2 new columns appended.
- add final select * from CTE C.
Relevant log output
No response
Environment
- dbt-core: Versionless
- dbt-snowflake: 1.9.0x
Additional Context
Needs refinement - may be generic dbt adapters issue.