-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 #1759 from fishtown-analytics/feature/snapshot-con…
…fig-block snapshot config blocks (#1613)
- Loading branch information
Showing
14 changed files
with
193 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
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
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
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
9 changes: 9 additions & 0 deletions
9
test/integration/004_simple_snapshot_test/test-check-col-snapshots-noconfig/snapshot.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% snapshot snapshot_actual %} | ||
select * from {{target.database}}.{{schema}}.seed | ||
{% endsnapshot %} | ||
|
||
{# This should be exactly the same #} | ||
{% snapshot snapshot_checkall %} | ||
{{ config(check_cols='all') }} | ||
select * from {{target.database}}.{{schema}}.seed | ||
{% endsnapshot %} |
41 changes: 41 additions & 0 deletions
41
test/integration/004_simple_snapshot_test/test-snapshots-select-noconfig/snapshot.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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% snapshot snapshot_actual %} | ||
|
||
{{ | ||
config( | ||
target_database=var('target_database', database), | ||
target_schema=var('target_schema', schema), | ||
) | ||
}} | ||
select * from {{target.database}}.{{target.schema}}.seed | ||
|
||
{% endsnapshot %} | ||
|
||
{% snapshot snapshot_castillo %} | ||
|
||
{{ | ||
config( | ||
target_database=var('target_database', database), | ||
updated_at='"1-updated_at"', | ||
) | ||
}} | ||
select id,first_name,last_name,email,gender,ip_address,updated_at as "1-updated_at" from {{target.database}}.{{schema}}.seed where last_name = 'Castillo' | ||
|
||
{% endsnapshot %} | ||
|
||
{% snapshot snapshot_alvarez %} | ||
|
||
{{ | ||
config( | ||
target_database=var('target_database', database), | ||
) | ||
}} | ||
select * from {{target.database}}.{{schema}}.seed where last_name = 'Alvarez' | ||
|
||
{% endsnapshot %} | ||
|
||
|
||
{% snapshot snapshot_kelly %} | ||
{# This has no target_database set, which is allowed! #} | ||
select * from {{target.database}}.{{schema}}.seed where last_name = 'Kelly' | ||
|
||
{% endsnapshot %} |
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
14 changes: 14 additions & 0 deletions
14
test/integration/014_hook_tests/test-kwargs-snapshots/snapshots.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% snapshot example_snapshot %} | ||
{{ | ||
config( | ||
target_schema=schema, | ||
unique_key='a', | ||
strategy='check', | ||
check_cols='all', | ||
post_hook='alter table {{ this }} add column new_col int') | ||
}} | ||
{{ | ||
config(post_hook='update {{ this }} set new_col = 1') | ||
}} | ||
select * from {{ ref('example_seed') }} | ||
{% endsnapshot %} |
7 changes: 7 additions & 0 deletions
7
test/integration/014_hook_tests/test-snapshot-models/schema.yml
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 @@ | ||
version: 2 | ||
models: | ||
- name: example_snapshot | ||
columns: | ||
- name: new_col | ||
tests: | ||
- not_null |
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,6 @@ | ||
{% snapshot example_snapshot %} | ||
{{ | ||
config(target_schema=schema, unique_key='a', strategy='check', check_cols='all') | ||
}} | ||
select * from {{ ref('example_seed') }} | ||
{% endsnapshot %} |
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