Skip to content

Commit

Permalink
deploy: b20c185
Browse files Browse the repository at this point in the history
  • Loading branch information
portovep committed Dec 7, 2024
1 parent 8362537 commit d5c3d16
Show file tree
Hide file tree
Showing 68 changed files with 2,670 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/catalog.json

Large diffs are not rendered by default.

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
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





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




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





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


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


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
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
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
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
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

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'
)


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


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


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
Loading

0 comments on commit d5c3d16

Please sign in to comment.