-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --target-path as a CLI option. (#5402)
- Loading branch information
1 parent
f304b4b
commit c521fa6
Showing
9 changed files
with
103 additions
and
3 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,8 @@ | ||
kind: Features | ||
body: 'Allow customizing `target-path` and `log-path` through | ||
environment variables and CLI flags.' | ||
time: 2022-06-22T19:23:29.748577478+03:00 | ||
custom: | ||
Author: isidentical | ||
Issue: "5399" | ||
PR: "5402" |
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
1 change: 1 addition & 0 deletions
1
test/integration/075_custom_target_path/models/do_nothing_1.sql
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 @@ | ||
select 1 as x |
1 change: 1 addition & 0 deletions
1
test/integration/075_custom_target_path/models/do_nothing_2.sql
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 @@ | ||
select 1 as y |
1 change: 1 addition & 0 deletions
1
test/integration/075_custom_target_path/models/do_nothing_3.sql
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 @@ | ||
select 1 as z |
44 changes: 44 additions & 0 deletions
44
test/integration/075_custom_target_path/test_target_path.py
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,44 @@ | ||
import os | ||
from unittest import mock | ||
from test.integration.base import DBTIntegrationTest, use_profile | ||
|
||
|
||
class TestTargetPathFromProjectConfig(DBTIntegrationTest): | ||
@property | ||
def project_config(self): | ||
return {"config-version": 2, "target-path": "project_target"} | ||
|
||
@property | ||
def schema(self): | ||
return "target_path_tests_075" | ||
|
||
@property | ||
def models(self): | ||
return "models" | ||
|
||
@use_profile("postgres") | ||
def test_postgres_overriden_target_path(self): | ||
results = self.run_dbt(args=["run"]) | ||
self.assertFalse(os.path.exists("./target")) | ||
self.assertTrue(os.path.exists("./project_target")) | ||
|
||
|
||
class TestTargetPathOverridenEnv(TestTargetPathFromProjectConfig): | ||
@use_profile("postgres") | ||
def test_postgres_overriden_target_path(self): | ||
with mock.patch.dict(os.environ, {"DBT_TARGET_PATH": "env_target"}): | ||
results = self.run_dbt(args=["run"]) | ||
self.assertFalse(os.path.exists("./target")) | ||
self.assertFalse(os.path.exists("./project_target")) | ||
self.assertTrue(os.path.exists("./env_target")) | ||
|
||
|
||
class TestTargetPathOverridenEnvironment(TestTargetPathFromProjectConfig): | ||
@use_profile("postgres") | ||
def test_postgres_overriden_target_path(self): | ||
with mock.patch.dict(os.environ, {"DBT_TARGET_PATH": "env_target"}): | ||
results = self.run_dbt(args=["run", "--target-path", "cli_target"]) | ||
self.assertFalse(os.path.exists("./target")) | ||
self.assertFalse(os.path.exists("./project_target")) | ||
self.assertFalse(os.path.exists("./env_target")) | ||
self.assertTrue(os.path.exists("./cli_target")) |
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