-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Aggregate Relationships (#16)
- Loading branch information
1 parent
b7501ad
commit bdf5c43
Showing
23 changed files
with
393 additions
and
41 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,8 @@ | ||
version: 2 | ||
|
||
models: | ||
|
||
- name: dataset__aggregate_after_1 | ||
tests: | ||
- dbt_utils.equality: | ||
compare_model: ref("output__aggregate_after_1") |
13 changes: 13 additions & 0 deletions
13
integration_tests/models/aggregate_after/dataset__aggregate_after_1.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,13 @@ | ||
{{ | ||
dbt_activity_schema.dataset( | ||
ref("input__aggregate_after"), | ||
dbt_activity_schema.activity(dbt_activity_schema.all_ever(), "signed up"), | ||
[ | ||
dbt_activity_schema.activity( | ||
dbt_activity_schema.aggregate_after(), | ||
"visit page", | ||
["activity_id"] | ||
) | ||
] | ||
) | ||
}} |
8 changes: 8 additions & 0 deletions
8
integration_tests/models/aggregate_all_ever/aggregate_all_ever.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,8 @@ | ||
version: 2 | ||
|
||
models: | ||
|
||
- name: dataset__aggregate_all_ever_1 | ||
tests: | ||
- dbt_utils.equality: | ||
compare_model: ref("output__aggregate_all_ever_1") |
13 changes: 13 additions & 0 deletions
13
integration_tests/models/aggregate_all_ever/dataset__aggregate_all_ever_1.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,13 @@ | ||
{{ | ||
dbt_activity_schema.dataset( | ||
ref("input__aggregate_all_ever"), | ||
dbt_activity_schema.activity(dbt_activity_schema.all_ever(), "signed up"), | ||
[ | ||
dbt_activity_schema.activity( | ||
dbt_activity_schema.aggregate_all_ever(), | ||
"visit page", | ||
["activity_id"] | ||
) | ||
] | ||
) | ||
}} |
8 changes: 8 additions & 0 deletions
8
integration_tests/models/aggregate_before/aggregate_before.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,8 @@ | ||
version: 2 | ||
|
||
models: | ||
|
||
- name: dataset__aggregate_before_1 | ||
tests: | ||
- dbt_utils.equality: | ||
compare_model: ref("output__aggregate_before_1") |
18 changes: 18 additions & 0 deletions
18
integration_tests/models/aggregate_before/dataset__aggregate_before_1.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,18 @@ | ||
{{ | ||
dbt_activity_schema.dataset( | ||
ref("input__aggregate_before"), | ||
dbt_activity_schema.activity(dbt_activity_schema.all_ever(), "bought something"), | ||
[ | ||
dbt_activity_schema.activity( | ||
dbt_activity_schema.aggregate_before(), | ||
"visit page", | ||
["activity_id"] | ||
), | ||
dbt_activity_schema.activity( | ||
dbt_activity_schema.aggregate_before(), | ||
"added to cart", | ||
["activity_id"] | ||
) | ||
] | ||
) | ||
}} |
8 changes: 8 additions & 0 deletions
8
integration_tests/models/aggregate_in_between/aggregate_in_between.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,8 @@ | ||
version: 2 | ||
|
||
models: | ||
|
||
- name: dataset__aggregate_in_between_1 | ||
tests: | ||
- dbt_utils.equality: | ||
compare_model: ref("output__aggregate_in_between_1") |
23 changes: 23 additions & 0 deletions
23
integration_tests/models/aggregate_in_between/dataset__aggregate_in_between_1.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,23 @@ | ||
{{ | ||
dbt_activity_schema.dataset( | ||
ref("input__aggregate_in_between"), | ||
dbt_activity_schema.activity(dbt_activity_schema.all_ever(), "visit page"), | ||
[ | ||
dbt_activity_schema.activity( | ||
dbt_activity_schema.aggregate_in_between(), | ||
"added to cart", | ||
["activity_id"] | ||
), | ||
dbt_activity_schema.activity( | ||
dbt_activity_schema.aggregate_in_between(dbt_activity_schema.sum), | ||
"bought something", | ||
["revenue_impact"] | ||
), | ||
dbt_activity_schema.activity( | ||
dbt_activity_schema.aggregate_in_between(), | ||
"bought something", | ||
["activity_id"] | ||
) | ||
] | ||
) | ||
}} |
17 changes: 17 additions & 0 deletions
17
integration_tests/seeds/aggregate_after/input__aggregate_after.csv
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,17 @@ | ||
activity_id,ts,entity_uuid,activity,anonymous_entity_uuid,feature_json,revenue_impact,link,activity_occurrence,activity_repeated_at | ||
1,2022-01-01 22:10:11,1,visit page,,"{""type"": 1}",0,,1,2022-01-03 22:10:11 | ||
2,2022-01-02 22:10:11,1,signed up,,"{""type"": 1}",0,,1, | ||
3,2022-01-03 22:10:11,1,visit page,,"{""type"": 2}",0,,2,2022-01-04 22:10:14 | ||
4,2022-01-04 22:10:12,1,added to cart,,"{""type"": 4}",0,,1,2022-01-04 22:10:13 | ||
5,2022-01-04 22:10:13,1,added to cart,,"{""type"": 4}",0,,2, | ||
6,2022-01-04 22:10:14,1,visit page,,"{""type"": 2}",0,,3,2022-01-06 22:10:16 | ||
7,2022-01-05 22:10:15,1,bought something,,"{""type"": 1}",100,,1, | ||
8,2022-01-06 22:10:16,1,visit page,,"{""type"": 1}",0,,4, | ||
9,2022-01-07 22:10:11,7,visit page,,"{""type"": 1}",0,,1,2022-01-09 22:10:11 | ||
10,2022-01-08 22:10:11,7,signed up,,"{""type"": 1}",0,,1, | ||
11,2022-01-09 22:10:11,7,visit page,,"{""type"": 2}",0,,2,2022-01-10 22:10:14 | ||
12,2022-01-10 22:10:12,7,added to cart,,"{""type"": 4}",0,,1,2022-01-10 22:10:13 | ||
13,2022-01-10 22:10:13,7,added to cart,,"{""type"": 4}",0,,2, | ||
14,2022-01-10 22:10:14,7,visit page,,"{""type"": 2}",0,,3,2022-01-12 22:10:16 | ||
15,2022-01-11 22:10:15,7,bought something,,"{""type"": 1}",100,,1, | ||
16,2022-01-12 22:10:16,7,visit page,,"{""type"": 1}",0,,4, |
3 changes: 3 additions & 0 deletions
3
integration_tests/seeds/aggregate_after/output/output__aggregate_after_1.csv
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 @@ | ||
activity_id,entity_uuid,ts,revenue_impact,aggregate_after_visit_page_activity_id | ||
2,1,2022-01-02 22:10:11,0,3 | ||
10,7,2022-01-08 22:10:11,0,3 |
17 changes: 17 additions & 0 deletions
17
integration_tests/seeds/aggregate_all_ever/input__aggregate_all_ever.csv
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,17 @@ | ||
activity_id,ts,entity_uuid,activity,anonymous_entity_uuid,feature_json,revenue_impact,link,activity_occurrence,activity_repeated_at | ||
1,2022-01-01 22:10:11,1,visit page,,"{""type"": 1}",0,,1,2022-01-03 22:10:11 | ||
2,2022-01-02 22:10:11,1,signed up,,"{""type"": 1}",0,,1, | ||
3,2022-01-03 22:10:11,1,visit page,,"{""type"": 2}",0,,2,2022-01-04 22:10:14 | ||
4,2022-01-04 22:10:12,1,added to cart,,"{""type"": 4}",0,,1,2022-01-04 22:10:13 | ||
5,2022-01-04 22:10:13,1,added to cart,,"{""type"": 4}",0,,2, | ||
6,2022-01-04 22:10:14,1,visit page,,"{""type"": 2}",0,,3,2022-01-06 22:10:16 | ||
7,2022-01-05 22:10:15,1,bought something,,"{""type"": 1}",100,,1, | ||
8,2022-01-06 22:10:16,1,visit page,,"{""type"": 1}",0,,4, | ||
9,2022-01-07 22:10:11,7,visit page,,"{""type"": 1}",0,,1,2022-01-09 22:10:11 | ||
10,2022-01-08 22:10:11,7,signed up,,"{""type"": 1}",0,,1, | ||
11,2022-01-09 22:10:11,7,visit page,,"{""type"": 2}",0,,2,2022-01-10 22:10:14 | ||
12,2022-01-10 22:10:12,7,added to cart,,"{""type"": 4}",0,,1,2022-01-10 22:10:13 | ||
13,2022-01-10 22:10:13,7,added to cart,,"{""type"": 4}",0,,2, | ||
14,2022-01-10 22:10:14,7,visit page,,"{""type"": 2}",0,,3,2022-01-12 22:10:16 | ||
15,2022-01-11 22:10:15,7,bought something,,"{""type"": 1}",100,,1, | ||
16,2022-01-12 22:10:16,7,visit page,,"{""type"": 1}",0,,4, |
3 changes: 3 additions & 0 deletions
3
integration_tests/seeds/aggregate_all_ever/output/output__aggregate_all_ever_1.csv
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 @@ | ||
activity_id,entity_uuid,ts,revenue_impact,aggregate_all_ever_visit_page_activity_id | ||
2,1,2022-01-02 22:10:11,0,4 | ||
10,7,2022-01-08 22:10:11,0,4 |
Oops, something went wrong.