Skip to content

Commit f9f888d

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

5 files changed

+93
-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,28 @@
1+
with staff_absence_events as (
2+
select * from {{ ref('base_ef3__staff_absence_events') }}
3+
),
4+
keyed as (
5+
select
6+
{{ dbt_utils.surrogate_key(
7+
[
8+
'tenant_code',
9+
'lower(absence_event_category)',
10+
'lower(survey_identifier)',
11+
'lower(namespace)',
12+
'lower(course_code)'
13+
]
14+
) }} as k_staff_absence_events,
15+
staff_absence_events.*
16+
{{ extract_extension(model_name=this.name, flatten=True) }}
17+
from staff_absence_events
18+
),
19+
deduped as (
20+
{{
21+
dbt_utils.deduplicate(
22+
relation='keyed',
23+
partition_by='k_staff_absence_events',
24+
order_by='api_year desc, pull_timestamp desc'
25+
)
26+
}}
27+
)
28+
select * from deduped
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
{{ dbt_utils.surrogate_key(
10+
[
11+
'tenant_code',
12+
'lower(education_organization_id)',
13+
'lower(event_date)'
14+
]
15+
) }} as k_survey_course_associations,
16+
base_survey_course_associations.*
17+
{{ extract_extension(model_name=this.name, flatten=True) }}
18+
from base_survey_course_associations
19+
),
20+
deduped as (
21+
{{
22+
dbt_utils.deduplicate(
23+
relation='keyed',
24+
partition_by='k_survey, k_course, entry_date, k_survey_course_associations',
25+
order_by='pull_timestamp desc'
26+
)
27+
}}
28+
)
29+
select * from deduped

0 commit comments

Comments
 (0)