Area: Product Issues
Sub-Area: Lineage, Caching and UI Consistency
Applies to: OSS + Cloud
Issue
You remove a lineage edge with the updateLineage GraphQL mutation or by writing the UpstreamLineage aspect with the Python SDK. The aspect no longer lists the upstream, but the Lineage tab and searchAcrossLineage responses still show the old edge for a while.
You Might Be Asking
- Why does the UI still show a lineage edge that I deleted?
- How do I confirm the lineage is really gone?
- Does
updateLineagealso remove column-level lineage? - Can I turn the lineage cache off?
Cause
DataHub GMS caches the result of the lineage graph walk that searchAcrossLineage uses. The cache is on by default (LINEAGE_SEARCH_CACHE_ENABLED, default true). The UI lineage views read through this cache, so a request made after your change can still get the cached walk from before it.
The cache entry expires on its own. On a self-hosted deployment with default settings, an entry expires 10 minutes after it was cached (CACHE_TTL_SECONDS, default 600).
A request that sets searchFlags: { skipCache: true } skips the cache and reads the current lineage graph.
Solution
1. Remove the lineage
Option A, the updateLineage mutation. It removes the dataset-level edge from the downstream dataset's UpstreamLineage aspect. It does not change column-level lineage (fineGrainedLineages), so column lineage from that upstream stays. Use Option B if you also need to remove column lineage.
mutation removeEdge {
updateLineage(
input: {
edgesToAdd: []
edgesToRemove: [
{
upstreamUrn: "<upstream-dataset-urn>"
downstreamUrn: "<downstream-dataset-urn>"
}
]
}
)
}
Option B, the Python SDK. This reads the current UpstreamLineage aspect, removes the upstream dataset and its column lineage, and writes the aspect back. It keeps every other entry because it starts from the current aspect. Column-level upstreams are schemaField URNs (urn:li:schemaField:(<dataset-urn>,<column>)), so the script matches them by prefix. Run it when no ingestion job is writing lineage for the same dataset.
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.ingestion.graph.client import get_default_graph
from datahub.metadata.schema_classes import UpstreamLineageClass
DOWNSTREAM = "<downstream-dataset-urn>"
UPSTREAM = "<upstream-dataset-urn>"
UPSTREAM_FIELD_PREFIX = f"urn:li:schemaField:({UPSTREAM},"
def from_removed_upstream(urn: str) -> bool:
return urn == UPSTREAM or urn.startswith(UPSTREAM_FIELD_PREFIX)
graph = get_default_graph()
lineage = graph.get_aspect(DOWNSTREAM, UpstreamLineageClass)
if lineage is None:
raise SystemExit("The downstream dataset has no UpstreamLineage aspect")
lineage.upstreams = [u for u in lineage.upstreams if u.dataset != UPSTREAM]
if lineage.fineGrainedLineages is not None:
kept = []
for fgl in lineage.fineGrainedLineages:
if fgl.upstreams:
fgl.upstreams = [u for u in fgl.upstreams if not from_removed_upstream(u)]
if not fgl.upstreams:
# Every upstream column of this entry came from the removed dataset
continue
kept.append(fgl)
lineage.fineGrainedLineages = kept
graph.emit(MetadataChangeProposalWrapper(entityUrn=DOWNSTREAM, aspect=lineage))
Pick one option per change. If an ingestion source also extracts lineage for this dataset, its next run can write the edge back. See the caution in the lineage guide.
2. Confirm the removal without the cache
Pass skipCache inside searchFlags. SearchAcrossLineageInput has no top-level skipCache field, so a query that puts it there fails validation. See SearchAcrossLineageInput.
query checkDownstreams {
searchAcrossLineage(
input: {
urn: "<upstream-dataset-urn>"
direction: DOWNSTREAM
start: 0
count: 100
searchFlags: { skipCache: true }
}
) {
total
freshness {
cached
}
searchResults {
degree
entity {
urn
}
}
}
}
If the downstream dataset is no longer in the results, the removal worked. freshness.cached tells you whether the response came from the cache.
3. Refresh the UI
On the entity's Lineage tab, in the list (impact analysis) view, click Refresh. That reloads the list without the cache. The other lineage views show the change once the cached entry expires.
4. Turn off the lineage cache (optional)
Turning the cache off makes every lineage request walk the graph again, so lineage pages load slower.
- Self-hosted: set
LINEAGE_SEARCH_CACHE_ENABLED=falseon GMS and restart it. - DataHub Cloud: contact DataHub Support.
If a skipCache: true query still returns the removed edge after your change was written, the cache is not the cause. Read the UpstreamLineage aspect again to check that the upstream is gone, then contact DataHub Support.