OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

[Bug] False version bumps during dbt ingestion of column-level constraints

Open aidanradford opened this issue 7 months ago • 1 comments

Affected module Backend (Java) and Ingestion Framework (Python/dbt). Does not impact the UI directly.

Describe the bug

  1. Ingestion (dbt_service.py): When cleaning non-required keys from the dbt manifest, the code iterated over the column dict (value) instead of each constraint object within value["constraints"]. This meant constraint data was never properly stripped, the column dict itself was being mutated, corrupting the structure before it could be parsed.

  2. Backend (TableRepository.java): When adding/updating a data model via addDataModel, the table was fetched without including tableConstraints in the requested fields. As a result, the existing constraints were always null when updateTableConstraints ran, this caused the dbt ingestion to alternate between the column having descriptions & constraints and not having them.

To Reproduce

Create a dbt model with column level constraints (applies for not_null, primary_key, foreign_key, etc.).

e.g.

models:
  - name: dimension_account
    description: A dimension representing an account.
    config:
      contract:
        enforced: true
    columns:
      - name: key
        description: The unique account key.
        data_type: STRING
        constraints:
          - type: primary_key
          - type: not_null

Observed repeated versioning in OM UI (version increments by 0.1 on every subsequent dbt run with 10 minor version updates overflowing into a major version update).

Image

Expected behavior

  • Column constraint objects in the dbt manifest should be cleaned of non-required keys (anything not in ["type", "name", "expression", "warn_unenforced", "warn_unsupported"]) without corrupting the column dict structure.
  • On subsequent dbt ingestion runs, existing table constraints on the OpenMetadata table entity should be correctly read and compared, so that only genuine constraint & description changes are recorded.

Version:

  • OS: not OS specific
  • Python version: 3.11
  • OpenMetadata version: 1.12.4
  • OpenMetadata Ingestion package version: 1.12.4

Additional context

  • Versioning appears to be working as expected on models without column level constraints

aidanradford avatar Apr 08 '26 08:04 aidanradford

hello @aidanradford . did column description get ingested properly in the UI when having constrains on column level? I have this bug when using constrains the dbt ingestion job doesn't properly ingest column description anymore and want to confirm if we need to move to 1.12.4 to fix this. thank you!

ioanamanole2804 avatar Apr 21 '26 08:04 ioanamanole2804