dbt-labs / dbt-snowflake

dbt-snowflake contains all of the code enabling dbt to work with Snowflake
https://getdbt.com
Apache License 2.0
297 stars 177 forks source link

[Bug] Cannot Update DynamicTable #1168

Open kds1010 opened 3 months ago

kds1010 commented 3 months ago

Is this a new bug in dbt-snowflake?

Current Behavior

When apply dbt run to an existing model materialized = 'dynamic_table, it fails with following error message:

 SnowflakeDynamicTableConfig.__init__() missing 6 required positional arguments: 'name', 'schema_name', 'database_name', 'query', 'target_lag', and 'snowflake_warehouse'

  > in macro dynamic_table_get_build_sql (macros/materializations/dynamic_table.sql)
  > called by macro materialization_dynamic_table_snowflake (macros/materializations/dynamic_table.sql)
  > called by model XXXXXX

Expected Behavior

Generate alter XXXX command to update the configuration. After the investigation, I've found that it seems this query returns column name with uppercase but here refers it as lowercase and it returns None for necessary configurations.

Steps To Reproduce

  1. Deploy a model with materialized = 'dynamic_table'
  2. Run again

Relevant log output

No response

Environment

- OS: Ubuntu 22.04
- Python: 3.11
- dbt-core: 1.8.5
- dbt-snowflake: 1.8.3

Additional Context

No response

amychen1776 commented 2 months ago

@kds1010 I'm struggling to recreate this issue. Per your message - does this mean that you create a dynamic table, successfully created it on the initial run and then subsequent runs, it fails? That error message seems specific to a column name.

Would you be able to provide a sample of your dynamic table code? Did you also change from a different materialization (like table) over to dynamic table?