snowflake.core.task.dagv1.DAGOperation¶
- class snowflake.core.task.dagv1.DAGOperation(schema: SchemaResource)¶
Bases:
objectAPIs to manage task graph child task operations.
Methods
- deploy(dag: DAG, mode: CreateMode = CreateMode.error_if_exists) None¶
Deploys (create) this task graph including all child tasks under a specific schema in Snowflake.
- Parameters:
dag (The
DAGinstance.)mode (CreateMode, optional) –
One of the following strings.
CreateMode.error_if_exists: Throw ansnowflake.core.exceptions.ConflictErrorif the task already exists in Snowflake. Equivalent to SQLcreate task <name> ....CreateMode.or_replace: Replace if the task already exists in Snowflake. Equivalent to SQLcreate or replace task <name> ....CreateMode.if_not_exists: Do nothing if the task already exists in Snowflake. Equivalent to SQLcreate task <name> if not exists...Default value is
CreateMode.error_if_exists.
- drop(dag: DAG | str, *, drop_finalizer: bool = False) None¶
Remove a task graph and all child tasks.
- Parameters:
dag (Union[DAG, str]) – Name of the task graph to be dropped or a
DAGinstance.drop_finalizer (bool) – If true, a finalizer task will also be dropped if it exists.
Examples
Drop a task graph:
- get_complete_dag_runs(dag: DAG | str, *, error_only: bool = True) list[DAGRun]¶
Get the complete task graph runs within 60 minutes in Snowflake.
- Parameters:
dag (Union[DAG, str]) – The task graph to get the task graph runs.
error_only (bool, optional) – If True, only return the task graph runs that have failed. Default is True.
Examples
Get the complete task graph runs:
- get_current_dag_runs(dag: DAG | str) list[DAGRun]¶
Get the current task graph runs or next schedule dag run for next 8 days in Snowflake.
- Parameters:
dag (Union[DAG, str]) – The task graph to get the task graph runs.
Examples
Get the current task graph runs:
- iter_dags(*, like: str) list[str]¶
Return the task graph names under this schema.
- Parameters:
like (str) – A case-insensitive string functioning as a filter, with support for SQL wildcard characters (% and _).
Examples
Get all task graph names under the schema: