Skip to content

Commit

Permalink
Merge pull request #2559 from fishtown-analytics/fix/alias-bug
Browse files Browse the repository at this point in the history
Fix a regression where dbt ignored aliases in config() calls
  • Loading branch information
beckjake authored Jun 18, 2020
2 parents 12ca721 + 1c1f100 commit c01056b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Contributors:
- dbt compile and ls no longer create schemas if they don't already exist ([#2525](https:/fishtown-analytics/dbt/issues/2525), [#2528](https:/fishtown-analytics/dbt/pull/2528))
- `dbt deps` now respects the `--project-dir` flag, so using `dbt deps --project-dir=/some/path` and then `dbt run --project-dir=/some/path` will properly find dependencies ([#2519](https:/fishtown-analytics/dbt/issues/2519), [#2534](https:/fishtown-analytics/dbt/pull/2534))
- `packages.yml` revision/version fields can be float-like again (`revision: '1.0'` is valid). ([#2518](https:/fishtown-analytics/dbt/issues/2518), [#2535](https:/fishtown-analytics/dbt/pull/2535))
- dbt again respects config aliases in config() calls ([#2557](https:/fishtown-analytics/dbt/issues/2557), [#2559](https:/fishtown-analytics/dbt/pull/2559))


## dbt 0.17.0 (June 08, 2020)
Expand Down
3 changes: 2 additions & 1 deletion core/dbt/context/context_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ def active_project_configs(
def _update_from_config(
self, result: T, partial: Dict[str, Any], validate: bool = False
) -> T:
translated = self.active_project.credentials.translate_aliases(partial)
return result.update_from(
partial,
translated,
self.active_project.credentials.type,
validate=validate
)
Expand Down
8 changes: 5 additions & 3 deletions test/integration/040_override_database_test/models/view_2.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{
config(database=var('alternate_db'))
}}
{%- if target.type == 'bigquery' -%}
{{ config(project=var('alternate_db')) }}
{%- else -%}
{{ config(database=var('alternate_db')) }}
{%- endif -%}
select * from {{ ref('seed') }}
2 changes: 2 additions & 0 deletions test/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,8 @@ def assertManyRelationsEqual(self, relations, default_schema=None, default_datab
first_columns = None
for relation in specs:
key = (relation.database, relation.schema, relation.identifier)
# get a good error here instead of a hard-to-diagnose KeyError
self.assertIn(key, column_specs, f'No columns found for {key}')
columns = column_specs[key]
if first_columns is None:
first_columns = columns
Expand Down

0 comments on commit c01056b

Please sign in to comment.