From a1c227095605d013ddaf58283bace05d09f564c8 Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Wed, 15 Jul 2020 17:11:25 -0600 Subject: [PATCH 1/3] azure pipelines silently messing with $PATH again --- azure-pipelines.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e4098a22b48..213ddab040f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,13 +37,13 @@ jobs: Set-Service -InputObject $serviceName -StartupType Automatic Start-Service -InputObject $serviceName - createdb.exe -U postgres dbt - psql.exe -U postgres -c "CREATE ROLE root WITH PASSWORD 'password';" - psql.exe -U postgres -c "ALTER ROLE root WITH LOGIN;" - psql.exe -U postgres -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;" - psql.exe -U postgres -c "CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER;" - psql.exe -U postgres -c "ALTER ROLE noaccess WITH LOGIN;" - psql.exe -U postgres -c "GRANT CONNECT ON DATABASE dbt TO noaccess;" + & $env:PGBIN\createdb.exe -U postgres dbt + & $env:PGBIN\psql.exe -U postgres -c "CREATE ROLE root WITH PASSWORD 'password';" + & $env:PGBIN\psql.exe -U postgres -c "ALTER ROLE root WITH LOGIN;" + & $env:PGBIN\psql.exe -U postgres -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;" + & $env:PGBIN\psql.exe -U postgres -c "CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER;" + & $env:PGBIN\psql.exe -U postgres -c "ALTER ROLE noaccess WITH LOGIN;" + & $env:PGBIN\psql.exe -U postgres -c "GRANT CONNECT ON DATABASE dbt TO noaccess;" displayName: Install postgresql and set up database - task: UsePythonVersion@0 From de4f90b3f4c661fe4e8b61247213c7052ad51347 Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Fri, 24 Jul 2020 14:56:27 -0600 Subject: [PATCH 2/3] clean without a profile --- CHANGELOG.md | 3 ++- core/dbt/task/clean.py | 6 +++-- .../test_simple_dependency.py | 22 ++++++++++++++----- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index caed4ad9287..13194d2595a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ### Fixes -- fast-fail option with adapters that don't support cancelling queries will now passthrough the original error messages ([#2644](https://github.com/fishtown-analytics/dbt/issues/2644)) +- fast-fail option with adapters that don't support cancelling queries will now passthrough the original error messages ([#2644](https://github.com/fishtown-analytics/dbt/issues/2644), [#2646](https://github.com/fishtown-analytics/dbt/pull/2646)) +- `dbt clean` no longer requries a profile ([#2620](https://github.com/fishtown-analytics/dbt/issues/2620), [#2649](https://github.com/fishtown-analytics/dbt/pull/2649)) Contributors: - [@joshpeng-quibi](https://github.com/joshpeng-quibi) ([#2646](https://github.com/fishtown-analytics/dbt/pull/2646)) diff --git a/core/dbt/task/clean.py b/core/dbt/task/clean.py index 84ef9b63532..8632c6e29e2 100644 --- a/core/dbt/task/clean.py +++ b/core/dbt/task/clean.py @@ -2,11 +2,13 @@ import os import shutil -from dbt.task.base import ConfiguredTask +from dbt.task.base import BaseTask from dbt.logger import GLOBAL_LOGGER as logger +from dbt.config import UnsetProfileConfig -class CleanTask(ConfiguredTask): +class CleanTask(BaseTask): + ConfigType = UnsetProfileConfig def __is_project_path(self, path): proj_path = os.path.abspath('.') diff --git a/test/integration/006_simple_dependency_test/test_simple_dependency.py b/test/integration/006_simple_dependency_test/test_simple_dependency.py index 837590c0265..28ce6244b63 100644 --- a/test/integration/006_simple_dependency_test/test_simple_dependency.py +++ b/test/integration/006_simple_dependency_test/test_simple_dependency.py @@ -1,5 +1,4 @@ import os -import shutil import tempfile from test.integration.base import DBTIntegrationTest, use_profile from dbt.exceptions import CompilationException @@ -34,6 +33,9 @@ def packages_config(self): def run_deps(self): return self.run_dbt(["deps"]) + def run_clean(self): + return self.run_dbt(['clean']) + @use_profile('postgres') def test_postgres_simple_dependency(self): self.run_deps() @@ -56,6 +58,10 @@ def test_postgres_simple_dependency(self): self.assertTablesEqual("seed", "view_model") self.assertTablesEqual("seed", "incremental") + assert os.path.exists('target') + self.run_clean() + assert not os.path.exists('target') + @use_profile('postgres') def test_postgres_simple_dependency_with_models(self): self.run_deps() @@ -73,6 +79,10 @@ def test_postgres_simple_dependency_with_models(self): self.assertEqual(created_models['view_model'], 'view') self.assertEqual(created_models['view_summary'], 'view') + assert os.path.exists('target') + self.run_clean() + assert not os.path.exists('target') + class TestSimpleDependencyUnpinned(DBTIntegrationTest): def setUp(self): @@ -234,9 +244,11 @@ def test_postgres_empty_models_not_compiled_in_dependencies(self): class TestSimpleDependencyNoProfile(TestSimpleDependency): def run_deps(self): - tmpdir = tempfile.mkdtemp() - try: + with tempfile.TemporaryDirectory() as tmpdir: result = self.run_dbt(["deps", "--profiles-dir", tmpdir]) - finally: - shutil.rmtree(tmpdir) + return result + + def run_clean(self): + with tempfile.TemporaryDirectory() as tmpdir: + result = self.run_dbt(["clean", "--profiles-dir", tmpdir]) return result From 0919c5642d6c20d0a7fb2ca32c8c1d33f3145699 Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Mon, 27 Jul 2020 13:42:21 -0600 Subject: [PATCH 3/3] Update CHANGELOG.md Co-authored-by: Jeremy Cohen --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13194d2595a..fedcda61b1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### Fixes - fast-fail option with adapters that don't support cancelling queries will now passthrough the original error messages ([#2644](https://github.com/fishtown-analytics/dbt/issues/2644), [#2646](https://github.com/fishtown-analytics/dbt/pull/2646)) -- `dbt clean` no longer requries a profile ([#2620](https://github.com/fishtown-analytics/dbt/issues/2620), [#2649](https://github.com/fishtown-analytics/dbt/pull/2649)) +- `dbt clean` no longer requires a profile ([#2620](https://github.com/fishtown-analytics/dbt/issues/2620), [#2649](https://github.com/fishtown-analytics/dbt/pull/2649)) Contributors: - [@joshpeng-quibi](https://github.com/joshpeng-quibi) ([#2646](https://github.com/fishtown-analytics/dbt/pull/2646))