Skip to content

Commit

Permalink
Merge pull request #2244 from fishtown-analytics/feature/source-aliases
Browse files Browse the repository at this point in the history
Add support for source aliases (#2133)
  • Loading branch information
beckjake authored Mar 26, 2020
2 parents 0188d03 + d88089f commit 5c69890
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Added --fail-fast argument for dbt run and dbt test to fail on first test failure or runtime error. ([#1649](https://github.com/fishtown-analytics/dbt/issues/1649), [#2224](https://github.com/fishtown-analytics/dbt/pull/2224))
- Support for appending query comments to SQL queries. ([#2138](https://github.com/fishtown-analytics/dbt/issues/2138), [#2199](https://github.com/fishtown-analytics/dbt/pull/2199))
- Added a `get-manifest` API call. ([#2168](https://github.com/fishtown-analytics/dbt/issues/2168), [#2232](https://github.com/fishtown-analytics/dbt/pull/2232))
- Support adapter-specific aliases (like `project` and `dataset` on BigQuery) in source definitions. ([#2133](https://github.com/fishtown-analytics/dbt/issues/2133), [#2244](https://github.com/fishtown-analytics/dbt/pull/2244))
- Users can now use jinja as arguments to tests. Test arguments are rendered in the native context and injected into the test execution context directly. ([#2149](https://github.com/fishtown-analytics/dbt/issues/2149), [#2220](https://github.com/fishtown-analytics/dbt/pull/2220))

### Fixes
Expand Down
1 change: 1 addition & 0 deletions core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ def get_unparsed_target(self) -> Iterable[SourceTarget]:

for data in self.get_key_dicts():
try:
data = self.project.credentials.translate_aliases(data)
data = self._renderer.render_schema_source(data)
source = UnparsedSourceDefinition.from_dict(data)
except (ValidationError, JSONValidationException) as exc:
Expand Down
9 changes: 9 additions & 0 deletions test/integration/022_bigquery_test/models/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ models:
- was_materialized:
name: fUnKyCaSe
type: view


sources:
- name: raw
project: "{{ target.database }}"
dataset: "{{ target.schema }}"
tables:
- name: seed
identifier: data_seed
2 changes: 1 addition & 1 deletion test/integration/022_bigquery_test/models/view_model.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ select
current_date as updated_at,
dupe

from {{ ref('data_seed') }}
from {{ source('raw', 'seed') }}

0 comments on commit 5c69890

Please sign in to comment.