Skip to content

Fixes #27792: Read dbt test descriptions from config.meta and patch on re-ingestion#27793

Open
nr-mdakilahmed wants to merge 3 commits intoopen-metadata:mainfrom
nr-mdakilahmed:fix/dbt-test-description-update
Open

Fixes #27792: Read dbt test descriptions from config.meta and patch on re-ingestion#27793
nr-mdakilahmed wants to merge 3 commits intoopen-metadata:mainfrom
nr-mdakilahmed:fix/dbt-test-description-update

Conversation

@nr-mdakilahmed
Copy link
Copy Markdown
Contributor

Fixes #27792

Changes

metadata.py:

  • Added _get_dbt_test_description() helper — resolves description from node.description (schema.yml) with fallback to node.config.meta["description"] (config block in SQL). Follows existing hasattr+truthiness guard pattern used throughout dbt_utils.py.
  • create_dbt_tests_definition() and create_dbt_test_case() now use the helper for both creation and update paths.
  • Added else blocks to patch descriptions on re-ingestion when entity exists, description is available, and dbtUpdateDescriptions is enabled.

test_dbt.py:

  • TestGetDbtTestDescription (7 tests) — covers priority, fallback, None, no-config, non-dict meta edge cases.
  • TestDbtDescriptionUpdateOnRerun (12 tests) — covers both methods x (patch, skip-disabled, skip-empty, create, config.meta-create, config.meta-rerun).

Why

  1. config.meta.description never read: dbt tests can carry descriptions via config(meta={'description': '...'}) which lands at node.config.meta.description in manifest.json. OM only reads node.description (the schema.yml path).

  2. Descriptions never updated on re-ingestion: dbtUpdateDescriptions: true patches table/column descriptions but TestDefinition and TestCase descriptions were silently skipped when the entity already exists.

patch_description() already supports both entity types — confirmed in patch_mixin.py (special TestCase handling with testDefinition,testSuite fields) and test_ometa_patch.py::test_patch_description_TestCase.

Type

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTING document.
  • My PR title follows the pattern Fixes <issue-number>: <short explanation>.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that cover exactly the scenarios fixed.
  • All new and existing tests passed (CI).

@nr-mdakilahmed nr-mdakilahmed requested a review from a team as a code owner April 28, 2026 10:11
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Comment thread ingestion/src/metadata/ingestion/source/database/dbt/metadata.py Outdated
…a and patch on re-ingestion

- Add _get_dbt_test_description() helper that resolves description from
  node.description (schema.yml) with fallback to node.config.meta["description"]
  (config() block in SQL file)
- Patch TestDefinition and TestCase descriptions on re-ingestion when
  dbtUpdateDescriptions is enabled
- Add 19 unit tests covering both fixes
@nr-mdakilahmed nr-mdakilahmed force-pushed the fix/dbt-test-description-update branch from 9357e9f to 1933af5 Compare April 28, 2026 10:20
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 28, 2026

Code Review ✅ Approved 1 resolved / 1 findings

Integrates dbt test descriptions from config.meta during re-ingestion, resolving the duplicate _get_dbt_test_description call. No issues found.

✅ 1 resolved
Performance: Duplicate _get_dbt_test_description call in else branches

📄 ingestion/src/metadata/ingestion/source/database/dbt/metadata.py:1439 📄 ingestion/src/metadata/ingestion/source/database/dbt/metadata.py:1448 📄 ingestion/src/metadata/ingestion/source/database/dbt/metadata.py:1495 📄 ingestion/src/metadata/ingestion/source/database/dbt/metadata.py:1504
_get_dbt_test_description(manifest_node) is called twice for the same node in both create_dbt_tests_definition and create_dbt_test_case — once in the creation path and again in the else (patch) path. Since the result only depends on manifest_node, it can be computed once before the if/else branch and reused. This is a readability/DRY nit — the function is cheap so there's no real performance concern.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

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.

dbt test descriptions: not read from config.meta and not updated on re-ingestion

1 participant