-
Notifications
You must be signed in to change notification settings - Fork 0
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 #11 from avohq/integration-tests-snowflake
Integration tests snowflake
- Loading branch information
Showing
10 changed files
with
187,708 additions
and
187,506 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
Large diffs are not rendered by default.
Oops, something went wrong.
187,446 changes: 93,723 additions & 93,723 deletions
187,446
integration_tests/data/avo_audit_test_data.csv
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% macro array_agg_ordered(column_name, sort_column, sort, new_name) %} | ||
{{ return(adapter.dispatch('array_agg_ordered', 'avo_audit')(column_name, sort_column, sort, new_name)) }} | ||
{% endmacro %} | ||
|
||
|
||
{% macro default__array_agg_ordered(column_name, sort_column, sort, new_name) %} | ||
|
||
ARRAY_AGG({{column_name}} order by {{sort_column}} {{sort}}) as {{new_name}} | ||
|
||
{% endmacro %} | ||
|
||
|
||
{% macro bigquery__array_agg_ordered(column_name, sort_column, sort, new_name) %} | ||
|
||
ARRAY_AGG({{column_name}} order by {{sort_column}} {{sort}}) as {{new_name}} | ||
|
||
{% endmacro %} | ||
|
||
{% macro snowflake__array_agg_ordered(column_name, sort_column, sort, new_name) %} | ||
|
||
ARRAY_AGG({{column_name}}) within group (order by {{sort_column}} {{sort}}) as {{new_name}} | ||
|
||
{% endmacro %} |
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,37 @@ | ||
{% macro find_signals(relation) %} | ||
{{ return(adapter.dispatch('find_signals', 'avo_audit')(relation)) }} | ||
{% endmacro %} | ||
|
||
|
||
{% macro default__find_signals(relation) %} | ||
|
||
select | ||
* | ||
from {{relation}} | ||
where | ||
(select signal FROM UNNEST(signals) AS signal where signal = 1 GROUP BY signal) = 1 | ||
OR (select signal from UNNEST(signals) AS signal where signal = -1 GROUP BY signal) = -1 | ||
|
||
{% endmacro %} | ||
|
||
|
||
{% macro bigquery__find_signals(relation) %} | ||
|
||
select | ||
* | ||
from {{relation}} | ||
where | ||
(select signal FROM UNNEST(signals) AS signal where signal = 1 GROUP BY signal) = 1 | ||
OR (select signal from UNNEST(signals) AS signal where signal = -1 GROUP BY signal) = -1 | ||
|
||
{% endmacro %} | ||
|
||
{% macro snowflake__find_signals(relation) %} | ||
select | ||
*, | ||
X.value::INTEGER as signal | ||
from {{relation}}, LATERAL FLATTEN({{relation}}.signals) X | ||
where signal = 1 OR signal = -1 | ||
|
||
|
||
{% endmacro %} |
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,34 @@ | ||
{% macro generate_dates_table(end_date, total_days) %} | ||
{{ return(adapter.dispatch('generate_dates_table', 'avo_audit')(end_date, total_days)) }} | ||
{% endmacro %} | ||
|
||
|
||
{% macro default__generate_dates_table(end_date, total_days) %} | ||
|
||
select day from UNNEST(GENERATE_DATE_ARRAY( | ||
{{dbt_date.n_days_ago(total_days, end_date)}}, | ||
{{end_date}}, | ||
INTERVAL 1 day)) as day | ||
|
||
{% endmacro %} | ||
|
||
|
||
{% macro bigquery__generate_dates_table(end_date, total_days) %} | ||
|
||
select day from UNNEST(GENERATE_DATE_ARRAY( | ||
{{dbt_date.n_days_ago(total_days, end_date)}}, | ||
{{end_date}}, | ||
INTERVAL 1 day)) as day | ||
|
||
{% endmacro %} | ||
|
||
{% macro snowflake__generate_dates_table(end_date, total_days) %} | ||
select | ||
dateadd( | ||
day, | ||
'-' || row_number() over (order by null), | ||
dateadd(day, '+1', {{end_date}}) | ||
) as day | ||
from table (generator(rowcount => {{total_days}})) | ||
|
||
{% endmacro %} |
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
Oops, something went wrong.