[Bug] dbt connector reads top-level column_name (null) instead of test_metadata.kwargs.column_name
Bug Description
When a dbt Cloud job runs dbt test only (not dbt build or dbt run + test), the manifest.json has column_name: null on test nodes, even though the correct column name exists in test_metadata.kwargs.column_name.
The dbt connector reads only the top-level column_name field. When it's null, it builds a table-level entity link instead of a column-level one. If the TestDefinition was previously created as entityType=COLUMN by another job, the server rejects the test case:
Column test case must have a field name and an array field name in the entity link.
e.g. <#E::table::{entityFqn}::columns::{columnName}>
Manifest Evidence
Test node from a dbt test only job manifest:
{
"name": "unique_my_model_MY_COLUMN",
"column_name": null,
"test_metadata": {
"name": "unique",
"kwargs": {
"column_name": "MY_COLUMN"
}
}
}
The column name is available in test_metadata.kwargs.column_name but the connector never reads it.
Affected Code
1. Entity link generation (dbt_utils.py, ~line 649):
column_name=manifest_node.column_name if hasattr(manifest_node, "column_name") else None
2. TestDefinition creation (metadata.py, ~line 1513):
if hasattr(manifest_node, "column_name") and manifest_node.column_name:
entity_type = EntityType.COLUMN
Proposed Fix
Fall back to test_metadata.kwargs.column_name when top-level is null:
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")
Apply in both dbt_utils.py (entity link) and metadata.py (TestDefinition entityType).
Steps to Reproduce
- Create two dbt Cloud jobs for the same model — Job A runs
dbt build, Job B runsdbt testonly - Run Job A through OM dbt ingestion — TestDefinition created with
entityType=COLUMN - Run Job B through OM dbt ingestion — manifest has
column_name: null - OM fails: "Column test case must have a field name and an array field name in the entity link"
Environment
- OM version: 1.11.8
- dbt source: dbt Cloud (REST API artifacts)
Hi, I'd like to work on this issue. Is it still available?