Skip to content

Commit

Permalink
Add relations cleanup in test_simple_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
damian3031 committed Aug 9, 2023
1 parent 8128502 commit 6089704
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/functional/adapter/test_simple_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,32 @@

@pytest.mark.iceberg
class TestSimpleCopyBase(SimpleCopyBase):
pass
def test_simple_copy_with_materialized_views(self, project):
project.run_sql(f"create table {project.test_schema}.unrelated_table (id int)")
sql = f"""
create materialized view {project.test_schema}.unrelated_materialized_view as (
select * from {project.test_schema}.unrelated_table
)
"""
project.run_sql(sql)
sql = f"""
create view {project.test_schema}.unrelated_view as (
select * from {project.test_schema}.unrelated_materialized_view
)
"""
project.run_sql(sql)
results = run_dbt(["seed"])
assert len(results) == 1
results = run_dbt()
assert len(results) == 7

# clean up
# TODO: check if this clean-up is still needed
# after implementing CASCADE in iceberg, delta, hive connectors
# if not, entire method could be deleted
project.run_sql("drop view unrelated_view")
project.run_sql("drop materialized view unrelated_materialized_view")
project.run_sql("drop table unrelated_table")


# Trino implementation of dbt.tests.fixtures.project.TestProjInfo.get_tables_in_schema
Expand Down

0 comments on commit 6089704

Please sign in to comment.