-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dbt-labs:main' into redshift_connector_2.0.914
- Loading branch information
Showing
19 changed files
with
181 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## dbt-redshift 1.7.0-b2 - September 15, 2023 | ||
|
||
### Features | ||
|
||
- use get_replace_sql in redshift__get_alter_materialized_view_as_sql, avoid renaming materialized views with custom table.sql and view.sql ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) | ||
|
||
### Fixes | ||
|
||
- allow auto_refresh to take in boolean and str values for materialized views ([#560](https://github.com/dbt-labs/dbt-redshift/issues/560)) | ||
- Fix to support removal of hologram, remove unused IAMDuration encoder ([#591](https://github.com/dbt-labs/dbt-redshift/issues/591)) | ||
- changes expected value types to AnyInteger to take into account changes in core ([#597](https://github.com/dbt-labs/dbt-redshift/issues/597)) | ||
|
||
### Under the Hood | ||
|
||
- Restructure macro files to be more granular; organize macros by relation and type (create, drop, etc.) ([#590](https://github.com/dbt-labs/dbt-redshift/issues/590)) | ||
- allow for bool/str input to backup/autorefresh when configuring materialized views ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) | ||
|
||
### Dependencies | ||
|
||
- Bump mypy from 1.5.0 to 1.5.1 ([#585](https://github.com/dbt-labs/dbt-redshift/pull/585)) | ||
- Update tox requirement from ~=4.9 to ~=4.10 ([#588](https://github.com/dbt-labs/dbt-redshift/pull/588)) | ||
- Update tox requirement from ~=4.10 to ~=4.11 ([#594](https://github.com/dbt-labs/dbt-redshift/pull/594)) | ||
- Update pre-commit requirement from ~=3.3 to ~=3.4 ([#596](https://github.com/dbt-labs/dbt-redshift/pull/596)) | ||
- Update black requirement from ~=23.7 to ~=23.9 ([#600](https://github.com/dbt-labs/dbt-redshift/pull/600)) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Under the Hood | ||
body: allow for bool/str input to backup/autorefresh when configuring materialized | ||
views | ||
time: 2023-09-14T13:55:47.951848-07:00 | ||
custom: | ||
Author: colin-rogers-dbt | ||
Issue: "606" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version = "1.7.0b1" | ||
version = "1.7.0b2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import Union | ||
|
||
|
||
def evaluate_bool_str(value: str) -> bool: | ||
value = value.strip().lower() | ||
if value == "true": | ||
return True | ||
elif value == "false": | ||
return False | ||
else: | ||
raise ValueError(f"Invalid boolean string value: {value}") | ||
|
||
|
||
def evaluate_bool(value: Union[str, bool]) -> bool: | ||
if not value: | ||
return False | ||
if isinstance(value, bool): | ||
return value | ||
elif isinstance(value, str): | ||
return evaluate_bool_str(value) | ||
else: | ||
raise TypeError( | ||
f"Invalid type for boolean evaluation, " | ||
f"expecting boolean or str, recieved: {type(value)}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from unittest.mock import Mock | ||
|
||
import pytest | ||
|
||
from dbt.adapters.redshift.relation_configs import RedshiftMaterializedViewConfig | ||
|
||
|
||
@pytest.mark.parametrize("bool_value", [True, False, "True", "False", "true", "false"]) | ||
def test_redshift_materialized_view_config_handles_all_valid_bools(bool_value): | ||
config = RedshiftMaterializedViewConfig( | ||
database_name="somedb", | ||
schema_name="public", | ||
mv_name="someview", | ||
query="select * from sometable", | ||
) | ||
model_node = Mock() | ||
model_node.config.extra.get = ( | ||
lambda x, y=None: bool_value if x in ["auto_refresh", "backup"] else "someDistValue" | ||
) | ||
config_dict = config.parse_model_node(model_node) | ||
assert isinstance(config_dict["autorefresh"], bool) | ||
assert isinstance(config_dict["backup"], bool) | ||
|
||
|
||
@pytest.mark.parametrize("bool_value", [1]) | ||
def test_redshift_materialized_view_config_throws_expected_exception_with_invalid_types( | ||
bool_value, | ||
): | ||
config = RedshiftMaterializedViewConfig( | ||
database_name="somedb", | ||
schema_name="public", | ||
mv_name="someview", | ||
query="select * from sometable", | ||
) | ||
model_node = Mock() | ||
model_node.config.extra.get = ( | ||
lambda x, y=None: bool_value if x in ["auto_refresh", "backup"] else "someDistValue" | ||
) | ||
with pytest.raises(TypeError): | ||
config.parse_model_node(model_node) | ||
|
||
|
||
def test_redshift_materialized_view_config_throws_expected_exception_with_invalid_str(): | ||
config = RedshiftMaterializedViewConfig( | ||
database_name="somedb", | ||
schema_name="public", | ||
mv_name="someview", | ||
query="select * from sometable", | ||
) | ||
model_node = Mock() | ||
model_node.config.extra.get = ( | ||
lambda x, y=None: "notABool" if x in ["auto_refresh", "backup"] else "someDistValue" | ||
) | ||
with pytest.raises(ValueError): | ||
config.parse_model_node(model_node) |