Skip to content

Commit

Permalink
Fix manage_schemas parsing from profile
Browse files Browse the repository at this point in the history
  • Loading branch information
bneijt committed Jun 17, 2022
1 parent 81a7f00 commit 1751ce0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 82 deletions.
2 changes: 1 addition & 1 deletion core/dbt/config/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def from_raw_profile_info(
target_name=target_name,
threads=threads,
user_config=user_config,
manage_schemas=False, # TODO
manage_schemas=profile_data.get("manage_schemas", False),
)

@classmethod
Expand Down
2 changes: 2 additions & 0 deletions core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from dbt.contracts.results import NodeStatus, RunResult, RunStatus, RunningStatus
from dbt.exceptions import (
warn_or_error,
warn,
CompilationException,
InternalException,
RuntimeException,
Expand Down Expand Up @@ -499,6 +500,7 @@ def manage_schema(self, adapter, results: List[RunResult]):

if not manage_schemas_config:
# TODO debug not doing anything
warn("Schema's configured to be managed, but manage_schemas is false in the profile")
return

if len(managed_schemas_actions_config) == 0:
Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions test/integration/077_schema_management_tests/models/schema.yml

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions test/integration/077_schema_management_tests/update.sql

This file was deleted.

32 changes: 15 additions & 17 deletions tests/functional/schema_management/test_drop_dangling_models.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import pytest
import os

from dbt.tests.util import run_dbt, check_table_does_exist, check_table_does_not_exist, write_file
from dbt.tests.util import (
run_dbt,
check_table_does_exist,
check_table_does_not_exist,
)

model = """
{{
config(
materialized = "table"
)
}}
with source_data as (
select 1 as id
union all
select null as id
)
select *
from source_data
SELECT * FROM (
VALUES (1, 'one'),
(2, 'two'),
(3, 'three')
) AS t (num,letter)
"""


@pytest.fixture(scope="class")
def models():
return {
"users.sql": model,
"numbers.sql": model,
}


Expand Down Expand Up @@ -61,12 +59,12 @@ def test_drop(
self,
project,
):
# create users model
# create numbers model
run_dbt(["run"])
check_table_does_exist(project.adapter, "users")
check_table_does_exist(project.adapter, "numbers")
check_table_does_not_exist(project.adapter, "baz")

# remove users model
# remove numbers model
project.update_models({})
run_dbt(["run"])
check_table_does_not_exist(project.adapter, "users")
check_table_does_not_exist(project.adapter, "numbers")

0 comments on commit 1751ce0

Please sign in to comment.