Skip to content

Commit 93b172c

Browse files
author
Vasili Zakharko
committed
feature: create base tpdm/edfi_3 models iteration 2, add staging models
1 parent 8026cc8 commit 93b172c

5 files changed

+84
-3
lines changed

models/staging/edfi_3/base/_edfi_3__base.yml

-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ models:
7979
- name: base_ef3__parents
8080
config:
8181
tags: ['core']
82-
- name: base_ef3__persons
83-
config:
84-
tags: ['core']
8582
- name: base_ef3__programs
8683
config:
8784
tags: ['core']

models/staging/edfi_3/stage/_edfi_3__stage.yml

+8
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@ models:
401401
config:
402402
tags: ['core']
403403

404+
- name: stg_ef3__school_year_types
405+
config:
406+
tags: ['core']
407+
404408
- name: stg_ef3__schools
405409
config:
406410
tags: ['core']
@@ -460,6 +464,10 @@ models:
460464
config:
461465
tags: ['core']
462466

467+
- name: stg_ef3__staff_absence_events
468+
config:
469+
tags: ['core']
470+
463471
- name: stg_ef3__staff_education_organization_assignment_associations
464472
config:
465473
tags: ['core']
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
with school_year_types as (
2+
select * from {{ ref('base_ef3__school_year_types') }}
3+
where not is_deleted
4+
),
5+
keyed as (
6+
select
7+
{{ dbt_utils.surrogate_key(
8+
[
9+
'tenant_code',
10+
'api_year',
11+
'lower(school_year)',
12+
'lower(current_school_year)'
13+
]
14+
)}} as k_school_year_types,
15+
api_year as school_year,
16+
school_year_types.*
17+
{{ extract_extension(model_name=this.name, flatten=True) }}
18+
from school_year_types
19+
),
20+
deduped as (
21+
{{
22+
dbt_utils.deduplicate(
23+
relation='keyed',
24+
partition_by='k_school_year_types',
25+
order_by='pull_timestamp desc'
26+
)
27+
}}
28+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
with staff_absence_events as (
2+
select * from {{ ref('base_ef3__staff_absence_events') }}
3+
),
4+
keyed as (
5+
select
6+
{{ gen_skey('k_staff') }},
7+
{{ dbt_utils.surrogate_key(
8+
[
9+
'tenant_code',
10+
'lower(record_guid)'
11+
]
12+
) }} as k_staff_absence_events,
13+
staff_absence_events.*
14+
{{ extract_extension(model_name=this.name, flatten=True) }}
15+
from staff_absence_events
16+
),
17+
deduped as (
18+
{{
19+
dbt_utils.deduplicate(
20+
relation='keyed',
21+
partition_by='k_staff, k_staff_absence_events',
22+
order_by='api_year desc, pull_timestamp desc'
23+
)
24+
}}
25+
)
26+
select * from deduped
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
with base_survey_course_associations as (
2+
select * from {{ ref('base_ef3__survey_course_associations') }}
3+
where not is_deleted
4+
),
5+
keyed as (
6+
select
7+
{{ gen_skey('k_survey') }},
8+
{{ gen_skey('k_course') }},
9+
base_survey_course_associations.*
10+
{{ extract_extension(model_name=this.name, flatten=True) }}
11+
from base_survey_course_associations
12+
),
13+
deduped as (
14+
{{
15+
dbt_utils.deduplicate(
16+
relation='keyed',
17+
partition_by='k_survey, k_course, entry_date',
18+
order_by='pull_timestamp desc'
19+
)
20+
}}
21+
)
22+
select * from deduped

0 commit comments

Comments
 (0)