Skip to content

fix(dagster-dbt): use the asset's own key for last-update freshness checks - #34432

Open
barlowa124 wants to merge 1 commit into
dagster-io:masterfrom
barlowa124:fix/freshness-check-asset-key
Open

barlowa124 wants to merge 1 commit into
dagster-io:masterfrom
barlowa124:fix/freshness-check-asset-key

Conversation

@barlowa124

Copy link
Copy Markdown

Summary & Motivation

build_freshness_checks_from_dbt_assets computed last-update freshness check keys with whichever DagsterDbtTranslator was left over from the loop over the input dbt_assets. The translator that belongs to the AssetsDefinition producing each asset was not used. When multiple @dbt_assets definitions use different translators (for example a custom get_asset_key that adds a prefix), freshness checks were attached to wrongly keyed assets. This passes the asset's own AssetKey directly, matching the time-partitioned branch. Fixes #34394.

Test Plan

  • Added test_last_update_multiple_assets_defs_custom_translator. The test builds two @dbt_assets definitions that share one manifest and gives the second a prefixing translator. It asserts each freshness check targets the correctly translated key. The test fails before this change and passes after.
  • pytest python_modules/libraries/dagster-dbt/dagster_dbt_tests/core/test_freshness_checks.py from python_modules/libraries/dagster-dbt: 7 passed.
  • ruff check --fix and ruff format clean on the touched files.

…hecks

build_freshness_checks_from_dbt_assets passed the translator left over
from the last-processed AssetsDefinition into
build_last_update_freshness_checks, so freshness check keys were computed
with the wrong DagsterDbtTranslator whenever multiple @dbt_assets used
different translators (e.g. custom get_asset_key prefixes). Pass the
asset key directly, matching the time-partitioned branch.

Fixes dagster-io#34394
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Fixes last-update freshness checks to use each asset’s own key instead of the last translator encountered.

  • Last-update freshness checks use the key resolved for each dbt asset.

Reviews (1) · Last reviewed commit: "fix(dagster-dbt): use the asset's own ke..." · Reviewed by Greptile

This branch has not been deployed

No deployments
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.

dagster-dbt: build_freshness_checks_from_dbt_assets targets the wrong asset key with multiple @dbt_assets

1 participant