-
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 runtime per-model warehouse config on snowflake models
Add warehouse config to snowflake Add concept of adapter-level pre/post model hooks Use those hooks to optionally set a warehouse on a per-model basis Added some integration tests - one tests that the warehouse is applied by setting a bad one and failing - one that tests that overriding the warehouse to a good one is ok
- Loading branch information
Jacob Beck
committed
Sep 27, 2019
1 parent
78a199f
commit 6748057
Showing
10 changed files
with
169 additions
and
10 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
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
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
2 changes: 2 additions & 0 deletions
2
test/integration/050_warehouse_test/models/expected_warehouse.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,2 @@ | ||
{{ config(materialized='table') }} | ||
select 'DBT_TEST_ALT' as warehouse |
2 changes: 2 additions & 0 deletions
2
test/integration/050_warehouse_test/models/invalid_warehouse.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,2 @@ | ||
{{ config(warehouse='DBT_TEST_DOES_NOT_EXIST') }} | ||
select current_warehouse() as warehouse |
2 changes: 2 additions & 0 deletions
2
test/integration/050_warehouse_test/models/override_warehouse.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,2 @@ | ||
{{ config(warehouse='DBT_TEST_ALT', materialized='table') }} | ||
select current_warehouse() as warehouse |
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,28 @@ | ||
from test.integration.base import DBTIntegrationTest, use_profile | ||
import os | ||
|
||
|
||
class TestDebug(DBTIntegrationTest): | ||
@property | ||
def schema(self): | ||
return 'dbt_warehouse_050' | ||
|
||
@staticmethod | ||
def dir(value): | ||
return os.path.normpath(value) | ||
|
||
@property | ||
def models(self): | ||
return self.dir('models') | ||
|
||
@use_profile('snowflake') | ||
def test_snowflake_override_ok(self): | ||
self.run_dbt([ | ||
'run', | ||
'--models', 'override_warehouse', 'expected_warehouse', | ||
]) | ||
self.assertManyRelationsEqual([['OVERRIDE_WAREHOUSE'], ['EXPECTED_WAREHOUSE']]) | ||
|
||
@use_profile('snowflake') | ||
def test_snowflake_override_noexist(self): | ||
self.run_dbt(['run', '--models', 'invalid_warehouse'], expect_pass=False) |
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