-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
2,670 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
...ed/dbt_testing_example/models/intermediate/int_weight_measurements_with_latest_height.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,30 @@ | ||
with | ||
|
||
height as ( | ||
|
||
select * from "neondb"."dbt_testing_example"."stg_gym_app__height" | ||
|
||
), | ||
|
||
weight as ( | ||
|
||
select * from "neondb"."dbt_testing_example"."stg_gym_app__weight" | ||
|
||
), | ||
|
||
enrich_with_lasted_height_recorded_before_the_weight_measurement as ( | ||
|
||
select | ||
weight.created_date, | ||
user_id, | ||
weight, | ||
(select height | ||
from height | ||
where height.created_date < weight.created_date and | ||
height.user_id = weight.user_id | ||
order by height.created_date DESC | ||
limit 1) as height | ||
from weight | ||
) | ||
|
||
select * from enrich_with_lasted_height_recorded_before_the_weight_measurement |
14 changes: 14 additions & 0 deletions
14
...s_indexes__models.yml/elementary_freshness_anomalies_9a86bd6e410f746dbd11fda53a1b4dbb.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 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
with nothing as (select 1 as num) | ||
select * from nothing where num = 2 | ||
|
||
|
||
|
||
|
||
|
11 changes: 11 additions & 0 deletions
11
...els/marts/_body_mass_indexes__models.yml/elementary_schema_changes_body_mass_indexes_.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,11 @@ | ||
|
||
|
||
|
||
|
||
|
||
with nothing as (select 1 as num) | ||
select * from nothing where num = 2 | ||
|
||
|
||
|
||
|
15 changes: 15 additions & 0 deletions
15
...s/marts/_body_mass_indexes__models.yml/elementary_volume_anomalies_body_mass_indexes_.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,15 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
with nothing as (select 1 as num) | ||
select * from nothing where num = 2 | ||
|
||
|
||
|
||
|
||
|
25 changes: 25 additions & 0 deletions
25
...s_indexes__models.yml/relationships_body_mass_indexe_2ce2c0087b52cfa92fbe92bbf3d083f4.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,25 @@ | ||
|
||
|
||
|
||
|
||
with child as ( | ||
select user_id as from_field | ||
from "neondb"."dbt_testing_example"."body_mass_indexes" | ||
where user_id is not null | ||
), | ||
|
||
parent as ( | ||
select user_id as to_field | ||
from "neondb"."dbt_testing_example"."raw_height" | ||
) | ||
|
||
select | ||
from_field | ||
|
||
from child | ||
left join parent | ||
on child.from_field = parent.to_field | ||
|
||
where parent.to_field is null | ||
|
||
|
25 changes: 25 additions & 0 deletions
25
...s_indexes__models.yml/relationships_body_mass_indexe_49d5aa6bb90fb311de636b464ab53ae0.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,25 @@ | ||
|
||
|
||
|
||
|
||
with child as ( | ||
select user_id as from_field | ||
from "neondb"."dbt_testing_example"."body_mass_indexes" | ||
where user_id is not null | ||
), | ||
|
||
parent as ( | ||
select user_id as to_field | ||
from "neondb"."dbt_testing_example"."raw_weight" | ||
) | ||
|
||
select | ||
from_field | ||
|
||
from child | ||
left join parent | ||
on child.from_field = parent.to_field | ||
|
||
where parent.to_field is null | ||
|
||
|
21 changes: 21 additions & 0 deletions
21
docs/compiled/dbt_testing_example/models/marts/body_mass_indexes.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,21 @@ | ||
with | ||
|
||
weights_with_latest_height as ( | ||
|
||
select * from "neondb"."dbt_testing_example"."int_weight_measurements_with_latest_height" | ||
|
||
), | ||
|
||
body_mass_indexes as ( | ||
|
||
select | ||
created_date, | ||
user_id, | ||
weight, | ||
height, | ||
round((weight::numeric / (height::numeric / 100) ^ 2)::numeric, 1) as bmi, | ||
current_timestamp as processed_at | ||
from weights_with_latest_height | ||
) | ||
|
||
select * from body_mass_indexes |
38 changes: 38 additions & 0 deletions
38
...raw_height_schema.yml/dbt_expectations_source_expect_89d58c60a30ca33e201a445d2f77dbfa.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,38 @@ | ||
with relation_columns as ( | ||
|
||
|
||
select | ||
cast('DATE' as TEXT) as relation_column, | ||
cast('TEXT' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('USER_ID' as TEXT) as relation_column, | ||
cast('INTEGER' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('HEIGHT' as TEXT) as relation_column, | ||
cast('DOUBLE PRECISION' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('HEIGHT_UNIT' as TEXT) as relation_column, | ||
cast('TEXT' as TEXT) as relation_column_type | ||
|
||
|
||
), | ||
test_data as ( | ||
|
||
select | ||
* | ||
from | ||
relation_columns | ||
where | ||
relation_column = 'HEIGHT' | ||
and | ||
relation_column_type not in ('DOUBLE PRECISION') | ||
|
||
) | ||
select * | ||
from test_data |
38 changes: 38 additions & 0 deletions
38
...raw_height_schema.yml/dbt_expectations_source_expect_d058c5e89bb36317bea26ae649047e21.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,38 @@ | ||
with relation_columns as ( | ||
|
||
|
||
select | ||
cast('DATE' as TEXT) as relation_column, | ||
cast('TEXT' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('USER_ID' as TEXT) as relation_column, | ||
cast('INTEGER' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('HEIGHT' as TEXT) as relation_column, | ||
cast('DOUBLE PRECISION' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('HEIGHT_UNIT' as TEXT) as relation_column, | ||
cast('TEXT' as TEXT) as relation_column_type | ||
|
||
|
||
), | ||
test_data as ( | ||
|
||
select | ||
* | ||
from | ||
relation_columns | ||
where | ||
relation_column = 'USER_ID' | ||
and | ||
relation_column_type not in ('INTEGER') | ||
|
||
) | ||
select * | ||
from test_data |
38 changes: 38 additions & 0 deletions
38
...raw_height_schema.yml/dbt_expectations_source_expect_d25b7d4c2c9fca23113cd8cbcfb14445.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,38 @@ | ||
with relation_columns as ( | ||
|
||
|
||
select | ||
cast('DATE' as TEXT) as relation_column, | ||
cast('TEXT' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('USER_ID' as TEXT) as relation_column, | ||
cast('INTEGER' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('HEIGHT' as TEXT) as relation_column, | ||
cast('DOUBLE PRECISION' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('HEIGHT_UNIT' as TEXT) as relation_column, | ||
cast('TEXT' as TEXT) as relation_column_type | ||
|
||
|
||
), | ||
test_data as ( | ||
|
||
select | ||
* | ||
from | ||
relation_columns | ||
where | ||
relation_column = 'HEIGHT_UNIT' | ||
and | ||
relation_column_type not in ('TEXT') | ||
|
||
) | ||
select * | ||
from test_data |
20 changes: 20 additions & 0 deletions
20
...raw_height_schema.yml/dbt_utils_source_accepted_rang_f11d86b3627432fa821d885e1ad1b432.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,20 @@ | ||
|
||
|
||
with meet_condition as( | ||
select * | ||
from "neondb"."dbt_testing_example"."raw_height" | ||
), | ||
|
||
validation_errors as ( | ||
select * | ||
from meet_condition | ||
where | ||
-- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds | ||
1 = 2 | ||
-- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule. | ||
or not height > 0 | ||
) | ||
|
||
select * | ||
from validation_errors | ||
|
22 changes: 22 additions & 0 deletions
22
...raw_height_schema.yml/source_accepted_values_gym_app_3616a0039aa603ccf6fea0c6e492ff79.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,22 @@ | ||
|
||
|
||
|
||
|
||
with all_values as ( | ||
|
||
select | ||
height_unit as value_field, | ||
count(*) as n_records | ||
|
||
from "neondb"."dbt_testing_example"."raw_height" | ||
group by height_unit | ||
|
||
) | ||
|
||
select * | ||
from all_values | ||
where value_field not in ( | ||
'cm','inches' | ||
) | ||
|
||
|
11 changes: 11 additions & 0 deletions
11
...ing/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_height.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,11 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
select height | ||
from "neondb"."dbt_testing_example"."raw_height" | ||
where height is null | ||
|
||
|
11 changes: 11 additions & 0 deletions
11
...ng/gym_app/_gym_app__raw_height_schema.yml/source_not_null_gym_app_raw_height_user_id.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,11 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
select user_id | ||
from "neondb"."dbt_testing_example"."raw_height" | ||
where user_id is null | ||
|
||
|
38 changes: 38 additions & 0 deletions
38
...raw_weight_schema.yml/dbt_expectations_source_expect_b59b3be08112542eac611e15e1c084e5.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,38 @@ | ||
with relation_columns as ( | ||
|
||
|
||
select | ||
cast('DATE' as TEXT) as relation_column, | ||
cast('TEXT' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('USER_ID' as TEXT) as relation_column, | ||
cast('INTEGER' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('WEIGHT' as TEXT) as relation_column, | ||
cast('DOUBLE PRECISION' as TEXT) as relation_column_type | ||
union all | ||
|
||
select | ||
cast('MEASUREMENT_UNIT' as TEXT) as relation_column, | ||
cast('TEXT' as TEXT) as relation_column_type | ||
|
||
|
||
), | ||
test_data as ( | ||
|
||
select | ||
* | ||
from | ||
relation_columns | ||
where | ||
relation_column = 'USER_ID' | ||
and | ||
relation_column_type not in ('INTEGER') | ||
|
||
) | ||
select * | ||
from test_data |
Oops, something went wrong.