Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADAP-923] [Bug] Materialized view config change identification not working #621

Closed
2 tasks done
cmcnicoll opened this issue Oct 1, 2023 · 7 comments · Fixed by #657
Closed
2 tasks done

[ADAP-923] [Bug] Materialized view config change identification not working #621

cmcnicoll opened this issue Oct 1, 2023 · 7 comments · Fixed by #657
Assignees
Labels

Comments

@cmcnicoll
Copy link

Is this a new bug in dbt-redshift?

  • I believe this is a new bug in dbt-redshift
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Materialized view config changes are identified when no config changes were made.

Expected Behavior

Config change identification works when no config changes were made.

Steps To Reproduce

  1. Set project config.
# test_mv\dbt_project.yml
models:
  test_mv:
    +auto_refresh: true
    +backup: false
    +materialized: materialized_view
    +on_configuration_change: fail
  1. Use source macro.
-- test_mv\models\example\my_first_dbt_model.sql
select * from {{ source('qa', 'account') }}
  1. First dbt run succeeds.
04:28:09  1 of 1 START sql materialized_view model dbt_mv.my_first_dbt_model ............. [RUN]
04:28:15  1 of 1 OK created sql materialized_view model dbt_mv.my_first_dbt_model ........ [SUCCESS in 5.39s]
  1. Second dbt run fails, but no config changes were made.
04:28:28  1 of 1 START sql materialized_view model dbt_mv.my_first_dbt_model ............. [RUN]
04:28:30  1 of 1 ERROR creating sql materialized_view model dbt_mv.my_first_dbt_model .... [ERROR in 1.72s]
04:28:31  
04:28:31  Finished running 1 materialized_view model in 0 hours 0 minutes and 7.46 seconds (7.46s).
04:28:31  
04:28:31  Completed with 1 error and 0 warnings:
04:28:31
04:28:31    FailFast Error in model my_first_dbt_model (models\example\my_first_dbt_model.sql)
  Configuration changes were identified and `on_configuration_change` was set to `fail` for `"skynet"."dbt_mv"."my_first_dbt_model"`

Relevant log output

No response

Environment

- OS: Windows 11 Pro
- Python: 3.11.5
- dbt-core: 1.6.4
- dbt-redshift: 1.6.2

Additional Context

No response

@cmcnicoll cmcnicoll added bug Something isn't working triage labels Oct 1, 2023
@github-actions github-actions bot changed the title [Bug] Configuration change identification not working [ADAP-923] [Bug] Configuration change identification not working Oct 1, 2023
@dbeatty10 dbeatty10 changed the title [ADAP-923] [Bug] Configuration change identification not working [ADAP-923] [Bug] Materialized view config change identification not working Oct 2, 2023
@dataders dataders self-assigned this Oct 3, 2023
@dataders
Copy link
Contributor

dataders commented Oct 4, 2023

thanks for both surfacing as well as the clean, reproducible example.

we know that the implementation shipped for 1.6.0 had some gaps, and you've discovered one.

Our goal is to first ship a working implementation for the upcoming minor release, 1.7.0. Once we have that, we'll evaluate backporting this functionality to 1.6. Can you please retry your example with dbt-redshift 1.7.0b2 (pip install dbt-redshift==1.7.0b2)?

@cmcnicoll
Copy link
Author

Thanks for the quick response! I recreated my venv and the error also occurs for the pre-release version.

- OS: Windows 11 Pro
- Python: 3.11.5
- dbt-core: 1.7.0-b2
- dbt-redshift: 1.7.0b2

@dataders dataders added pre-regression Regression not yet in a stable release regression and removed bug Something isn't working labels Oct 5, 2023
@cmcnicoll
Copy link
Author

I ran into another 2nd dbt run error that might be related to this issue. Same steps to reproduce, except for two things:

  1. Use +on_configuration_change: apply.
  2. The source table is empty.
04:05:14    Compilation Error in model my_first_dbt_model (models\example\my_first_dbt_model.sql)
  RedshiftMaterializedViewConfig.__init__() missing 3 required positional arguments: 'mv_name', 'schema_name', and 'database_name'

  > in macro get_materialized_view_configuration_changes (macros\relations\materialized_view\alter.sql)
  > called by macro materialized_view_get_build_sql (macros\materializations\models\materialized_view.sql)
  > called by macro materialization_materialized_view_default (macros\materializations\models\materialized_view.sql)
  > called by model my_first_dbt_model (models\example\my_first_dbt_model.sql)

@mikealfare
Copy link
Contributor

I think this might actually be resolved by this PR: #643

@cmcnicoll
Copy link
Author

Thanks for reviewing this issue @mikealfare. I recreated my venv with the latest version, but the error is still occurring.

- OS: Windows 11 Pro
- Python: 3.11.5
- dbt-core: 1.6.7
- dbt-redshift: 1.6.3

@mikealfare
Copy link
Contributor

Thanks for the response. Confirming that you're correct, you're on the latest version of dbt-core and dbt-redshift for 1.6. I looked into it a bit more and I think it's the backup parameter. I'll take a look. I don't believe this is monitored for config changes with on_configuration_change, but it might still be coming up as a change since the default is True.

@mikealfare
Copy link
Contributor

Thank you for your example, I was able to produce a test case using that example to demonstrate the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants