Skip to content

Commit

Permalink
Add support for source aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Mar 25, 2020
1 parent 0a382c4 commit 3ba7fe3
Show file tree
Hide file tree
Showing 4 changed files with 11 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))
- Support for appending query comments to SQL queries. ([#2138](https://github.com/fishtown-analytics/dbt/issues/2138))
- 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))

### Fixes
- When a jinja value is undefined, give a helpful error instead of failing with cryptic "cannot pickle ParserMacroCapture" errors ([#2110](https://github.com/fishtown-analytics/dbt/issues/2110), [#2184](https://github.com/fishtown-analytics/dbt/pull/2184))
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 @@ -495,6 +495,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
8 changes: 8 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,11 @@ models:
- was_materialized:
name: fUnKyCaSe
type: view


sources:
- name: raw
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 3ba7fe3

Please sign in to comment.