-
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.
Fix the renamed relations code (#723)
* Add test * Add FrozenSet to imports * removed extraneous semicolons * update alter table to alter view for rename --------- Co-authored-by: Mila Page <[email protected]> Co-authored-by: Mike Alfare <[email protected]> Co-authored-by: Mike Alfare <[email protected]>
- Loading branch information
1 parent
f92ec48
commit c99c73b
Showing
6 changed files
with
41 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Add unit test for transaction semantics. | ||
time: 2024-02-27T00:27:13.299107-08:00 | ||
custom: | ||
Author: versusfacit | ||
Issue: "722" |
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
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,3 +1,3 @@ | ||
{% macro redshift__get_rename_view_sql(relation, new_name) %} | ||
alter view {{ relation }} rename to {{ new_name }} | ||
alter table {{ relation }} rename to {{ new_name }} | ||
{% endmacro %} |
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,17 @@ | ||
from dbt.adapters.redshift.relation import RedshiftRelation | ||
from dbt.adapters.contracts.relation import RelationType | ||
|
||
|
||
def test_renameable_relation(): | ||
relation = RedshiftRelation.create( | ||
database="my_db", | ||
schema="my_schema", | ||
identifier="my_table", | ||
type=RelationType.Table, | ||
) | ||
assert relation.renameable_relations == frozenset( | ||
{ | ||
RelationType.View, | ||
RelationType.Table, | ||
} | ||
) |