Skip to content

Commit

Permalink
Apply new integration tests to existing framework to identify support…
Browse files Browse the repository at this point in the history
…ed features (#540)

* Apply new integration tests to existing framework
* Fix `auto_refresh` input parameter
* Update tests to use shared framework in `dbt-core`

---------

Co-authored-by: colin-rogers-dbt <[email protected]>
  • Loading branch information
mikealfare and colin-rogers-dbt authored Jul 17, 2023
1 parent 493148e commit 49b2606
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 315 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20230714-160100.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Enumerate implemented materialized view features via integration test flags and change `autorefresh` to `auto_refresh`
time: 2023-07-14T16:01:00.54015-04:00
custom:
Author: mikealfare
Issue: dbt-labs/dbt-core#6911
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dev: ## Installs adapter in develop mode along with development dependencies
dev-uninstall: ## Uninstalls all packages while maintaining the virtual environment
## Useful when updating versions, or if you accidentally installed into the system interpreter
pip freeze | grep -v "^-e" | cut -d "@" -f1 | xargs pip uninstall -y
pip uninstall -y dbt-redshift

.PHONY: mypy
mypy: ## Runs mypy against staged changes for static type checking.
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/redshift/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RedshiftConfig(AdapterConfig):
sort: Optional[str] = None
bind: Optional[bool] = None
backup: Optional[bool] = True
autorefresh: Optional[bool] = False
auto_refresh: Optional[bool] = False


class RedshiftAdapter(SQLAdapter):
Expand Down
6 changes: 3 additions & 3 deletions dbt/adapters/redshift/relation_configs/materialized_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def parse_model_node(cls, model_node: ModelNode) -> dict:
"mv_name": model_node.identifier,
"schema_name": model_node.schema,
"database_name": model_node.database,
"backup": model_node.config.get("backup"),
"autorefresh": model_node.config.get("auto_refresh"),
"backup": model_node.config.extra.get("backup"),
"autorefresh": model_node.config.extra.get("auto_refresh"),
}

if query := model_node.compiled_code:
Expand Down Expand Up @@ -174,7 +174,7 @@ 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": {"t": True, "f": False}.get(materialized_view.get("autorefresh")),
"autorefresh": materialized_view.get("autorefresh"),
"query": cls._parse_query(query.get("definition")),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
diststyle {{ materialized_view.dist.diststyle }}
{% if materialized_view.dist.distkey %}distkey ({{ materialized_view.dist.distkey }}){% endif %}
{% if materialized_view.sort.sortkey %}sortkey ({{ ','.join(materialized_view.sort.sortkey) }}){% endif %}
auto refresh {% if materialized_view.auto_refresh %}yes{% else %}no{% endif %}
auto refresh {% if materialized_view.autorefresh %}yes{% else %}no{% endif %}
as (
{{ materialized_view.query }}
);
Expand Down
85 changes: 0 additions & 85 deletions tests/functional/adapter/materialized_view_tests/fixtures.py

This file was deleted.

Loading

0 comments on commit 49b2606

Please sign in to comment.