snowflake.snowpark.lineage.Lineage.trace¶
- Lineage.trace(object_name: str, object_domain: str, *, object_version: Optional[str] = None, direction: Union[str, LineageDirection] = LineageDirection.BOTH, distance: int = 2) DataFrame[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/lineage.py#L548-L626)¶
Traces the lineage of an object within Snowflake and returns it as a DataFrame.
- Parameters:
object_name (str) – The fully qualified name of the Snowflake object to start trace, formatted as below: Non-Case-sensitive: “database.schema.object” Case-sensitive: “”database”.”schema”.”object””
object_domain (str) – The domain of the Snowflake object to start trace. e.g., “table”, “view”.
object_version (Optional[str]) – Version of the versioned Snowflake object (e.g., model or dataset) to begin tracing. Defaults to None.
direction (LineageDirection) – The direction to trace (UPSTREAM, DOWNSTREAM, BOTH), defaults to BOTH.
distance (int) – Trace distance, defaults to 2, with a maximum of 10.
- Returns:
- A DataFrame representing the traced lineage with the following schema:
source (str): The source of the lineage.
target (str): The target of the lineage.
direction (str): The direction of the lineage (‘FORWARD’, ‘BACKWARD’, or ‘BOTH’).
distance (int): The distance of the lineage tracing from given object.
Example
- Return type:
This function or method is in private preview since 1.16.0.