-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add marts__combined__coursesinprogram as a reference table
- Loading branch information
1 parent
2dd05d4
commit bb6befd
Showing
2 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 28 additions & 1 deletion
29
src/ol_dbt/models/marts/combined/_marts__combined__models.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
60 changes: 60 additions & 0 deletions
60
src/ol_dbt/models/marts/combined/marts__combined_coursesinprogram.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,60 @@ | ||
with mitx_programs as ( | ||
select * from {{ ref('int__mitx__program_requirements') }} | ||
) | ||
|
||
, mitx__courses as ( | ||
select * from {{ ref('int__mitx__courses') }} | ||
) | ||
|
||
, mitxpro__courses as ( | ||
select * from {{ ref('int__mitxpro__courses') }} | ||
) | ||
|
||
, mitxpro__programs as ( | ||
select * from {{ ref('int__mitxpro__programs') }} | ||
) | ||
|
||
, mitxonline__programs as ( | ||
select * from {{ ref('int__mitxonline__programs') }} | ||
) | ||
|
||
select | ||
'MITx Online' as platform | ||
, mitx__courses.course_title | ||
, mitx_programs.program_title | ||
, mitx_programs.mitxonline_program_id as program_id | ||
, mitx__courses.course_readable_id | ||
, mitxonline__programs.program_readable_id | ||
from mitx_programs | ||
inner join mitx__courses | ||
on mitx_programs.course_number = mitx__courses.course_number | ||
left join mitxonline__programs | ||
on mitx_programs.mitxonline_program_id = mitxonline__programs.program_id | ||
where mitx__courses.is_on_mitxonline = true | ||
|
||
union all | ||
|
||
select | ||
'edX.org' as platform | ||
, mitx__courses.course_title | ||
, mitx_programs.program_title | ||
, mitx_programs.micromasters_program_id as program_id | ||
, mitx__courses.course_readable_id | ||
, null as program_readable_id | ||
from mitx_programs | ||
inner join mitx__courses | ||
on mitx_programs.course_number = mitx__courses.course_number | ||
where mitx__courses.is_on_mitxonline = false | ||
|
||
union all | ||
|
||
select | ||
'xPro' as platform | ||
, mitxpro__courses.course_title | ||
, mitxpro__programs.program_title | ||
, mitxpro__courses.program_id | ||
, mitxpro__courses.course_readable_id | ||
, mitxpro__programs.program_readable_id | ||
from mitxpro__courses | ||
inner join mitxpro__programs | ||
on mitxpro__courses.program_id = mitxpro__programs.program_id |