-
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.
feat: add extended course block dimension table
This change introduces another dimension table, dim_course_blocks_extended, which includes the section and subsection names to which each block belongs. This is included as a separate model instead of adding onto dim_course_blocks so as to avoid any unnecessary joins when a model requires block metadata but does not need the extra information joined into dim_course_blocks by this new model.
- Loading branch information
1 parent
1540bd5
commit 357a246
Showing
2 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
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,32 @@ | ||
select | ||
blocks.org as org, | ||
blocks.course_key as course_key, | ||
blocks.course_name as course_name, | ||
blocks.course_run as course_run, | ||
blocks.block_id as block_id, | ||
blocks.block_name as block_name, | ||
blocks.section_number as section_number, | ||
blocks.subsection_number as subsection_number, | ||
blocks.hierarchy_location as hierarchy_location, | ||
blocks.display_name_with_location as display_name_with_location, | ||
blocks.graded as graded, | ||
blocks.block_type as block_type, | ||
section_blocks.display_name_with_location as section_with_name, | ||
subsection_blocks.display_name_with_location as subsection_with_name | ||
from {{ ref("dim_course_blocks") }} blocks | ||
left join | ||
{{ ref("dim_course_blocks") }} section_blocks | ||
on ( | ||
blocks.section_number = section_blocks.hierarchy_location | ||
and blocks.org = section_blocks.org | ||
and blocks.course_key = section_blocks.course_key | ||
and section_blocks.block_id like '%@chapter+block@%' | ||
) | ||
left join | ||
{{ ref("dim_course_blocks") }} subsection_blocks | ||
on ( | ||
blocks.subsection_number = subsection_blocks.hierarchy_location | ||
and blocks.org = subsection_blocks.org | ||
and blocks.course_key = subsection_blocks.course_key | ||
and subsection_blocks.block_id like '%@sequential+block@%' | ||
) |
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