Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for source aliases (#2133) #2244

Merged
merged 2 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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') }}