Skip to content

Fix DST timezone handling in from_iso8601_timestamp and suppress dimensional FK test failures#2139

Merged
rachellougee merged 2 commits into
mainfrom
fix-dbt-errors-in-dimensional-models
Apr 7, 2026
Merged

Fix DST timezone handling in from_iso8601_timestamp and suppress dimensional FK test failures#2139
rachellougee merged 2 commits into
mainfrom
fix-dbt-errors-in-dimensional-models

Conversation

@rachellougee
Copy link
Copy Markdown
Contributor

What are the relevant tickets?

https://pipelines.odl.mit.edu/runs/bf45b0b7-9a49-4cd6-9c5d-93c6deafd6b2

[31mFailure in model edxorg_to_mitxonline_course_runs (models/migration/edxorg_to_mitxonline_course_runs.sql)[0m

  Database Error in model edxorg_to_mitxonline_course_runs (models/migration/edxorg_to_mitxonline_course_runs.sql)
  TrinoUserError(type=USER_ERROR, name=INVALID_FUNCTION_ARGUMENT, message="Invalid format: "2025-08-01Z" is malformed at "Z"", query_id=20260407_121338_48983_j63u4)
  compiled code at target/full_dbt_project-bf45b0b-0ab5b43/run/open_learning/models/migration/edxorg_to_mitxonline_course_runs.sql

[31mFailure in test relationships_tfact_enrollment_user_fk__user_pk__ref_dim_user_ (models/dimensional/_fact_tables.yml)[0m

  Got 269 results, configured to fail if >10

[31mFailure in test relationships_tfact_certificate_user_fk__user_pk__ref_dim_user_ (models/dimensional/_fact_tables.yml)[0m

  Got 11 results, configured to fail if >10

related to
#1868

Description (What does it do?)

  • improve timezone handling in from_iso8601_timestamp function
  • suppress dimensional FK test failures on user_fk in two new fact tables. So that these FK failures don't block other models

How can this be tested?

dbt build --select edxorg_to_mitxonline_course_runs
dbt test --select tfact_enrollment tfact_certificate

Additional Context

Copilot AI review requested due to automatic review settings April 7, 2026 15:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the dbt cross-database from_iso8601_timestamp macro to better handle timezone-less ISO strings (including plain YYYY-MM-DD dates) in Trino, and adjusts two dimensional FK relationship tests so they stop blocking builds when user FKs don’t fully resolve.

Changes:

  • Update Trino’s from_iso8601_timestamp wrapper to treat YYYY-MM-DD as midnight UTC (T00:00:00Z) and only append Z for naive datetimes without an explicit zone.
  • Change relationships tests on user_fk for tfact_enrollment and tfact_certificate to use severity: warn.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/ol_dbt/macros/cross_db_functions.sql Improves Trino parsing for date-only and naive datetime strings to avoid invalid formats and DST-gap issues.
src/ol_dbt/models/dimensional/_fact_tables.yml Attempts to make two user_fk relationship tests non-blocking by lowering severity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ol_dbt/models/dimensional/_fact_tables.yml
Comment thread src/ol_dbt/models/dimensional/_fact_tables.yml
@rachellougee rachellougee requested a review from blarghmatey April 7, 2026 15:36
@rachellougee rachellougee merged commit 8b425c3 into main Apr 7, 2026
10 checks passed
@rachellougee rachellougee deleted the fix-dbt-errors-in-dimensional-models branch April 7, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants