feat(#2088): migrate marts__micromasters_dedp_exam_grades to dim_course_run#2403
feat(#2088): migrate marts__micromasters_dedp_exam_grades to dim_course_run#2403quazi-h wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the marts__micromasters_dedp_exam_grades mart so the MITxOnline branch sources semester and passing_grade from the dimensional model dim_course_run (intended to centralize and de-duplicate that derivation).
Changes:
- Add a
dim_course_run-backed CTE for MITxOnlinesemester/passing_grade. - Replace MITxOnline output columns to read from
dim_course_runinstead of the intermediate proctored-exam grades model. - Keep the pure-MicroMasters branch unchanged (still sourcing those fields directly from the MicroMasters intermediate model).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from ( | ||
| select | ||
| courserun_readable_id | ||
| , semester |
There was a problem hiding this comment.
I'm getting the following error currently when running the build
15:21:32 Completed with 1 error, 0 partial successes, and 1 warning:
15:21:32
15:21:32 Failure in model marts__micromasters_dedp_exam_grades (models/marts/micromasters/marts__micromasters_dedp_exam_grades.sql)
15:21:32 Database Error in model marts__micromasters_dedp_exam_grades (models/marts/micromasters/marts__micromasters_dedp_exam_grades.sql)
TrinoUserError(type=USER_ERROR, name=COLUMN_NOT_FOUND, message="line 35:15: Column 'semester' cannot be resolved", query_id=20260708_152128_00035_4j8nd)
compiled code at target/run/open_learning/models/marts/micromasters/marts__micromasters_dedp_exam_grades.sql
There was a problem hiding this comment.
This was hitting the production dim_course_run table before its full-refresh completed (needed after #2319 added semester/passing_grade — see the SCD2 self-referential-read caveat that also caused a similar Dagster failure on courserun_upgrade_deadline this week). The refresh finished successfully in production earlier today and semester/passing_grade are confirmed present. Please pull latest main and retry the build — let us know if it still fails.
There was a problem hiding this comment.
I'm getting another error with the build but I think it might be taken care of the update you mentioned that went in before this:
00:55:24 Completed with 1 error, 0 partial successes, and 0 warnings:
00:55:24
00:55:24 Failure in test not_null_marts__micromasters_dedp_exam_grades_semester (models/marts/micromasters/_marts_micromasters__models.yml)
00:55:24 Got 8137 results, configured to fail if >10
…se_run Sources semester and passing_grade for the MITxOnline branch from dim_course_run (added in #2319) instead of re-deriving them via a duplicate join to the MicroMasters staging model in int__mitxonline__proctored_exam_grades. The pure-MicroMasters branch still reads these fields from int__micromasters__dedp_proctored_exam_grades, since those exam runs have no corresponding dim_course_run row until MicroMasters grades are added to tfact_grade (epic #2072). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add row_number()-based dedup (partition by courserun_readable_id, order by effective_date desc) before joining dim_course_run, guarding against the same SCD2 expiration-gap fan-out risk already handled in dim_product. - Rename mitxonline_courserun_semester_grade -> mitxonline_courserun_metadata since the CTE selects course-run metadata (semester, passing_grade), not grade facts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
d64395e to
1ba8823
Compare
🔎 ol-dbt impact — column-level blast radius✅ No column-level downstream impact detected for the changed models. Posted by |
What are the relevant tickets?
Partially addresses #2088 (follow-up to #2319 —
dim_course_runsemester/passing_grade)Description (What does it do?)
Migrates the MITxOnline branch of
marts__micromasters_dedp_exam_gradesto sourcesemesterandpassing_gradefromdim_course_run(added in #2319) instead of re-deriving them via a duplicate join to the MicroMasters staging model insideint__mitxonline__proctored_exam_grades.Not migrated in this PR (scope note, same reasoning documented on #2319 by @quazi-h):
micromasters_exam_grades, sourced fromint__micromasters__dedp_proctored_exam_grades) still readssemester/passing_gradedirectly. Those exam runs have no correspondingdim_course_runrow (only MITxOnline course runs matched to a MicroMasters exam run are represented there), so this branch can't be migrated until MicroMasters grades are added totfact_grade(epic [Epic] Migrate mart and reporting models to use the dimensional layer #2072).int__models pending that same epic.How can this be tested?
dbt build --select dim_course_run marts__micromasters_dedp_exam_grades(requires feat(dimensional): add semester + passing_grade to dim_course_run from MicroMasters exam runs #2319 merged first)semester/proctoredexamgrade_passing_gradevalues are unchanged from before the migration (same underlying source join, now centralized indim_course_run).Additional Context
Deployment order:
semester/passing_gradetodim_course_run)marts__micromasters_dedp_exam_gradesis a non-incremental view overint_/dim_course_run, so no full-refresh is needed for this mart itself.