OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

[Feature] dbt connector: fall back to test_metadata.kwargs.column_name when top-level column_name is null

Open md-akilahmed opened this issue 8 months ago • 1 comments

Is your feature request related to a problem?

When ingesting dbt test results from dbt Cloud jobs that run dbt test only (not dbt build), the manifest has column_name: null on test nodes. The connector reads only this top-level field and builds a table-level entity link. Column-level tests then fail to ingest with:

Column test case must have a field name and an array field name in the entity link.
e.g. <#E::table::{entityFqn}::columns::{columnName}>

Describe the solution you'd like

The dbt connector should fall back to test_metadata.kwargs.column_name when the top-level column_name is null.

The manifest already contains the correct column name — it's just in a nested location:

{
  "name": "unique_my_model_MY_COLUMN",
  "column_name": null,
  "test_metadata": {
    "name": "unique",
    "kwargs": {
      "column_name": "MY_COLUMN"
    }
  }
}

Suggested change in both dbt_utils.py (entity link generation) and metadata.py (TestDefinition creation):

column_name = getattr(manifest_node, "column_name", None)
if not column_name and hasattr(manifest_node, "test_metadata"):
    kwargs = getattr(manifest_node.test_metadata, "kwargs", {})
    if isinstance(kwargs, dict):
        column_name = kwargs.get("column_name")

Use case

Organizations often have separate dbt Cloud jobs for the same models:

  • Job A runs dbt build (run + test) on production
  • Job B runs dbt test only on staging (for CI validation)

Both should be able to ingest test results into OpenMetadata. Currently only Job A works because its manifest populates the top-level column_name. Job B fails because the test-only manifest leaves it as null.

Additional context

  • OM version: 1.11.8
  • dbt source: dbt Cloud (REST API artifacts)
  • Related issue: #26605

md-akilahmed avatar Mar 19 '26 16:03 md-akilahmed

Hi, I'd like to work on this issue. Is it still available?

kojikokojiko avatar Mar 22 '26 10:03 kojikokojiko