get_lineage_for_resource¶
- LineageApi.get_lineage_for_resource(role_id, resource, id, depth=None, timestamp=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Get lineage graph for a resource
Returns the lineage graph for a resource as LineageGraph (array of nodes with Input/Output edges). For a job, call with resource=jobs (path /jobs/{id}/lineageV2). Also supports datasets (/datasets/{id}/lineageV2) and datasources (/datasources/{id}/lineageV2). Caller must have access to the root resource (else AUTH-1011). Connected nodes include AccessType; inaccessible neighbors set AccessRestricted and strip Metadata / LatestRunInfo / EventTime. Job and datasource nodes may include LatestRunInfo. Safe to retry (read-only).
- Parameters:
role_id (str) – Amorphic role ID. Must grant access to the root resource. Missing role_id returns AUTH-1001. (required)
resource (str) – Resource type segment. Use jobs for /jobs/{id}/lineageV2, datasets for /datasets/{id}/lineageV2, datasources for /datasources/{id}/lineageV2. Other values return GE-1106. (required)
id (str) – Resource UUID (JobId when resource=jobs, else DatasetId or DatasourceId). Rejected with IPV-1002 if the resource does not exist. (required)
depth (int) – Levels to traverse from the root. Defaults to 5. Values less than 1 return IPV-1012 (error text references 1-10; LINEAGE_MAX_DEPTH=10 is not enforced as an upper bound today).
timestamp (str) – Historical point-in-time in %Y-%m-%d %H:%M:%S (else IPV-1035). Must be >= the resource creation time — CreationTime for jobs and datasources, CreationDate for datasets (else IPV-1036). When set, deleted connected resources may include ResourceDeleted=true.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: GET /{resource}/{id}/lineageV2
Parameter examples¶
Name |
In |
Example |
|---|---|---|
|
path |
|
|
path |
|
|
query |
|
|
query |
|
Success (HTTP 200)¶
Lineage graph for the resource. Each node has ResourceId, ResourceType, Input, Output, and usually ResourceName, Metadata, EventTime; jobs/datasources may include LatestRunInfo.
Job root (/jobs/{id}/lineageV2) with downstream dataset
{
"LineageGraph": [
{
"ResourceId": "e4f5a6b7-c8d9-0123-4567-89abcdef0123",
"ResourceType": "jobs",
"ResourceName": "orders_etl",
"AccessType": "owner",
"EventTime": "2024-06-01 11:55:00",
"Metadata": {},
"LatestRunInfo": {
"RunId": "f0e1d2c3-b4a5-6978-0123-456789abcdef"
},
"Input": [],
"Output": [
{
"Origin": "e4f5a6b7-c8d9-0123-4567-89abcdef0123",
"Destination": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"
}
]
},
{
"ResourceId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
"ResourceType": "datasets",
"ResourceName": "monthly_orders",
"AccessType": "readonly",
"EventTime": "2024-06-01 12:00:00",
"Metadata": {},
"Input": [
{
"Origin": "e4f5a6b7-c8d9-0123-4567-89abcdef0123",
"Destination": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"
}
],
"Output": []
}
]
}
Dataset root (/datasets/{id}/lineageV2) with upstream job
{
"LineageGraph": [
{
"ResourceId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
"ResourceType": "datasets",
"ResourceName": "monthly_orders",
"AccessType": "owner",
"EventTime": "2024-06-01 12:00:00",
"Metadata": {},
"Input": [
{
"Origin": "e4f5a6b7-c8d9-0123-4567-89abcdef0123",
"Destination": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"
}
],
"Output": []
},
{
"ResourceId": "e4f5a6b7-c8d9-0123-4567-89abcdef0123",
"ResourceType": "jobs",
"ResourceName": "orders_etl",
"AccessType": "readonly",
"EventTime": "2024-06-01 11:55:00",
"Metadata": {},
"LatestRunInfo": {},
"Input": [],
"Output": [
{
"Origin": "e4f5a6b7-c8d9-0123-4567-89abcdef0123",
"Destination": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"
}
]
}
]
}
Neighbor node without access
{
"LineageGraph": [
{
"ResourceId": "c3d8e4f2-9a6b-5c7d-0e1f-3a4b5c6d7e8f",
"ResourceType": "datasets",
"ResourceName": "hidden_ds",
"AccessType": null,
"AccessRestricted": true,
"AccessNote": "You don't have access to view details for this dataset",
"Metadata": {},
"Input": [],
"Output": []
}
]
}
Errors¶
Documented error codes: AUTH-1001, AUTH-1011, IPV-1002, GE-1106, IPV-1012, IPV-1035, IPV-1036, GE-1008, EMF-1001.
HTTP 400
Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Common codes: AUTH-1001 (missing role_id), AUTH-1011 (no access to root resource), IPV-1002 (unknown id), GE-1106 (unsupported resource), IPV-1012 (depth < 1), IPV-1035 (bad timestamp format), IPV-1036 (timestamp before creation). Note: this lambda maps most typed errors including GenericFailureException to HTTP 400.
Missing role_id header
{
"Message": "AUTH-1001 - Missing role information in event header"
}
No access to root resource
{
"Message": "AUTH-1011 - User user1 is not authorized to view resource details"
}
Unknown job id
{
"Message": "IPV-1002 - Invalid JobId - e4f5a6b7-c8d9-0123-4567-89abcdef0123, resource not found."
}
Unknown dataset id
{
"Message": "IPV-1002 - Invalid DatasetId - b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f, resource not found."
}
depth less than 1
{
"Message": "IPV-1012 - Invalid parameter - depth, value should be between 1-10"
}
timestamp format invalid
{
"Message": "IPV-1035 - Invalid parameter - timestamp, it must be in %Y-%m-%d %H:%M:%S format"
}
HTTP 500
Unhandled backend failure. Body is {“Message”: “<CODE> - <text>”} (typically GE-1008 via EMF-1001).
Unexpected failure
{
"Message": "GE-1008 - Something went wrong, please try after sometime"
}