forked from dbt-labs/dbt-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'kickstarter/feature/model-aliasing' int…
…o model-aliasing $ git merge kickstarter/feature/model-aliasing CONFLICT (content): Merge conflict in dbt/utils.py CONFLICT (modify/delete): dbt/include/global_project/macros/materializations/table.sql deleted in HEAD and modified in kickstarter/feature/model-aliasing. Version kickstarter/feature/model-aliasing of dbt/include/global_project/macros/materializations/table.sql left in tree. CONFLICT (modify/delete): dbt/include/global_project/macros/materializations/bigquery.sql deleted in HEAD and modified in kickstarter/feature/model-aliasing. Version kickstarter/feature/model-aliasing of dbt/include/global_project/macros/materializations/bigquery.sql left in tree. 1. dbt/utils.py Some major changes are being introduced in 0.10.1: Implement relations api (dbt-labs#727) dbt-labs#727 dbt-labs@5344f54#diff-196bbfafed32edaf1554550f65111f87 The Relation class was extracted into ... ./dbt/api/object.py class APIObject(dict) ./dbt/adapters/default/relation.py class DefaultRelation(APIObject) ./dbt/adapters/bigquery/relation.py class BigQueryRelation(DefaultRelation) ./dbt/adapters/snowflake/relation.py class SnowflakeRelation(DefaultRelation) Changing node.get('name') to node.get('alias') ... ./dbt/adapters/default/relation.py ./dbt/adapters/bigquery/relation.py ./dbt/adapters/snowflake/relation.py 2. dbt/include/global_project/macros/materializations/table.sql This was renamed to ... ./dbt/include/global_project/macros/materializations/table/table.sql 3. dbt/include/global_project/macros/materializations/bigquery.sql This was split into ... ./dbt/include/global_project/macros/materializations/table/bigquery_table.sql and ... ./dbt/include/global_project/macros/materializations/view/bigquery_view.sql 4. other instances of model['name'] The following file also mention model['name'] and probably need to change as well ... ./dbt/include/global_project/macros/materializations/archive/archive.sql ./dbt/include/global_project/macros/materializations/seed/bigquery.sql ./dbt/include/global_project/macros/materializations/seed/seed.sql Added comentary to ... ./dbt/exceptions.py 5. further changes Revert model.get('alias') to model.get('name') ... print_test_result_line in ./dbt/ui/printer.py (since in this context schema is NOT being used) Change model.get('name') to model.get('alias') ... print_seed_result_line in ./dbt/ui/printer.py (since in this context schema is also being used) Change node.get('name') to node.get('alias') ... _node_context in ./dbt/node_runners.py (since in this context schema is also being used) call_get_missing_columns in ./dbt/node_runners.py (since in this context schema is also being used) call_already_exists in ./dbt/node_runners.py (since in this context schema is also being used) 6. linting import lines must be under 80 characters https://www.python.org/dev/peps/pep-0328/
- Loading branch information
Showing
23 changed files
with
154 additions
and
27 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
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
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: 1 addition & 1 deletion
2
dbt/include/global_project/macros/materializations/table/table.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
2 changes: 1 addition & 1 deletion
2
dbt/include/global_project/macros/materializations/view/bigquery_view.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
2 changes: 1 addition & 1 deletion
2
dbt/include/global_project/macros/materializations/view/view.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
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
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,10 @@ | ||
|
||
{{ | ||
config( | ||
alias='foo', | ||
materialized='table' | ||
) | ||
}} | ||
|
||
SELECT | ||
'{{ this.alias }}' as "tablename" |
18 changes: 18 additions & 0 deletions
18
test/integration/026_aliases_test/models/ref_foo_alias.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,18 @@ | ||
|
||
{{ | ||
config( | ||
materialized='table' | ||
) | ||
}} | ||
|
||
WITH trigger_ref AS ( | ||
SELECT | ||
* | ||
FROM | ||
-- we should still be able to ref a model by its filepath | ||
{{ ref('foo_alias') }} | ||
) | ||
|
||
SELECT | ||
-- this name should still be the filename | ||
'{{ this.alias }}' as "tablename" |
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,60 @@ | ||
from nose.plugins.attrib import attr | ||
from test.integration.base import DBTIntegrationTest | ||
|
||
|
||
class TestAliases(DBTIntegrationTest): | ||
|
||
def setUp(self): | ||
DBTIntegrationTest.setUp(self) | ||
|
||
@property | ||
def schema(self): | ||
return "aliases_026" | ||
|
||
@property | ||
def models(self): | ||
return "test/integration/026_aliases_test/models" | ||
|
||
@property | ||
def profile_config(self): | ||
return { | ||
'test': { | ||
'outputs': { | ||
'dev': { | ||
'type': 'postgres', | ||
'threads': 1, | ||
'host': 'database', | ||
'port': 5432, | ||
'user': "root", | ||
'pass': "password", | ||
'dbname': 'dbt', | ||
'schema': self.unique_schema() | ||
}, | ||
}, | ||
'target': 'dev' | ||
} | ||
} | ||
|
||
@property | ||
def query_foo_alias(self): | ||
return """ | ||
select | ||
tablename | ||
from {schema}.foo | ||
""".format(schema=self.unique_schema()) | ||
|
||
@property | ||
def query_ref_foo_alias(self): | ||
return """ | ||
select | ||
tablename | ||
from {schema}.ref_foo_alias | ||
""".format(schema=self.unique_schema()) | ||
|
||
@attr(type='postgres') | ||
def test__alias_model_name(self): | ||
self.run_dbt(['run']) | ||
result = self.run_sql(self.query_foo_alias, fetch='all')[0][0] | ||
self.assertEqual(result, 'foo') | ||
result = self.run_sql(self.query_ref_foo_alias, fetch='all')[0][0] | ||
self.assertEqual(result, 'ref_foo_alias') |
Oops, something went wrong.