-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #275 from fishtown-analytics/fix/bq-schema-pattern
Handle schema pattern on BQ
- Loading branch information
Showing
7 changed files
with
85 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
user_id,event | ||
5,play | ||
6,pause |
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,7 @@ | ||
user_id,event | ||
1,play | ||
2,pause | ||
3,play | ||
4,pause | ||
5,play | ||
6,pause |
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 |
---|---|---|
|
@@ -46,3 +46,7 @@ seeds: | |
num_buckets: integer | ||
min_value: float | ||
max_value: float | ||
|
||
sql: | ||
data_events_20180103: | ||
+schema: events |
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
16 changes: 14 additions & 2 deletions
16
integration_tests/models/sql/test_get_relations_by_pattern.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 |
---|---|---|
@@ -1,4 +1,16 @@ | ||
{{ config(materialized = 'table') }} | ||
|
||
{% set relations = dbt_utils.get_relations_by_pattern(target.schema, 'data_events_%') %} | ||
{{ dbt_utils.union_relations(relations) }} | ||
{% set relations = dbt_utils.get_relations_by_pattern(target.schema ~ '%', 'data_events_%') %} | ||
|
||
with unioned as ( | ||
|
||
{{ dbt_utils.union_relations(relations) }} | ||
|
||
) | ||
|
||
select | ||
|
||
user_id, | ||
event | ||
|
||
from unioned |
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