diff --git a/.changes/unreleased/Dependencies-20231010-195348.yaml b/.changes/unreleased/Dependencies-20231010-195348.yaml new file mode 100644 index 000000000..4e8af02c1 --- /dev/null +++ b/.changes/unreleased/Dependencies-20231010-195348.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Bump mypy from 1.5.1 to 1.6.0" +time: 2023-10-10T19:53:48.00000Z +custom: + Author: dependabot[bot] + PR: 629 diff --git a/.changes/unreleased/Dependencies-20231013-190517.yaml b/.changes/unreleased/Dependencies-20231013-190517.yaml new file mode 100644 index 000000000..8db17538a --- /dev/null +++ b/.changes/unreleased/Dependencies-20231013-190517.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update pre-commit requirement from ~=3.4 to ~=3.5" +time: 2023-10-13T19:05:17.00000Z +custom: + Author: dependabot[bot] + PR: 634 diff --git a/.changes/unreleased/Dependencies-20231017-191545.yaml b/.changes/unreleased/Dependencies-20231017-191545.yaml new file mode 100644 index 000000000..407615e32 --- /dev/null +++ b/.changes/unreleased/Dependencies-20231017-191545.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update black requirement from ~=23.9 to ~=23.10" +time: 2023-10-17T19:15:45.00000Z +custom: + Author: dependabot[bot] + PR: 636 diff --git a/.changes/unreleased/Fixes-20231025-203732.yaml b/.changes/unreleased/Fixes-20231025-203732.yaml new file mode 100644 index 000000000..9e6bf1af7 --- /dev/null +++ b/.changes/unreleased/Fixes-20231025-203732.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix parsing of database results for materialized view auto refresh +time: 2023-10-25T20:37:32.191259-04:00 +custom: + Author: mikealfare + Issue: "643" diff --git a/dbt/adapters/redshift/relation_configs/materialized_view.py b/dbt/adapters/redshift/relation_configs/materialized_view.py index 1c6fb229a..44e18e3ac 100644 --- a/dbt/adapters/redshift/relation_configs/materialized_view.py +++ b/dbt/adapters/redshift/relation_configs/materialized_view.py @@ -182,10 +182,14 @@ def parse_relation_results(cls, relation_results: RelationResults) -> dict: "mv_name": materialized_view.get("table"), "schema_name": materialized_view.get("schema"), "database_name": materialized_view.get("database"), - "autorefresh": materialized_view.get("autorefresh"), "query": cls._parse_query(query.get("definition")), } + autorefresh_value = materialized_view.get("autorefresh") + if autorefresh_value is not None: + bool_filter = {"t": True, "f": False} + config_dict["autorefresh"] = bool_filter.get(autorefresh_value, autorefresh_value) + # the default for materialized views differs from the default for diststyle in general # only set it if we got a value if materialized_view.get("diststyle"): diff --git a/dev-requirements.txt b/dev-requirements.txt index 4b3b09cda..e254bf52c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -6,7 +6,7 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-postgres&subdirectory=plugi # if version 1.x or greater -> pin to major version # if version 0.x -> pin to minor -black~=23.9 +black~=23.10 bumpversion~=0.6.0 click~=8.1 ddtrace~=1.19 @@ -14,9 +14,9 @@ flake8~=6.1 flaky~=3.7 freezegun~=1.2 ipdb~=0.13.13 -mypy==1.5.1 # patch updates have historically introduced breaking changes +mypy==1.6.0 # patch updates have historically introduced breaking changes pip-tools~=7.3 -pre-commit~=3.4 +pre-commit~=3.5 pre-commit-hooks~=4.4 pytest~=7.4 pytest-csv~=3.0 diff --git a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py index cf7d433c7..d2bf1cda4 100644 --- a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py +++ b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py @@ -163,19 +163,6 @@ def test_change_is_applied_via_alter_str_true(self, project, my_materialized_vie assert_message_in_logs(f"Applying ALTER to: {my_materialized_view}", logs) assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs, False) - def test_change_is_applied_via_alter_str_false(self, project, my_materialized_view): - self.check_start_state(project, my_materialized_view) - - self.change_config_via_alter_str_false(project, my_materialized_view) - _, logs = run_dbt_and_capture_with_retries_redshift_mv( - ["--debug", "run", "--models", my_materialized_view.name] - ) - - self.check_state_alter_change_is_applied_str_false(project, my_materialized_view) - - assert_message_in_logs(f"Applying ALTER to: {my_materialized_view}", logs) - assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs, False) - def test_change_is_applied_via_replace(self, project, my_materialized_view): self.check_start_state(project, my_materialized_view)