snowflake.core.task.dagv1.DAG¶
- class snowflake.core.task.dagv1.DAG(name: str, *, schedule: Cron | timedelta | None = None, warehouse: str | None = None, user_task_managed_initial_warehouse_size: str | None = None, error_integration: str | None = None, comment: str | None = None, task_auto_retry_attempts: int | None = None, allow_overlapping_execution: bool | None = None, overlap_policy: OverlapPolicy | None = None, user_task_timeout_ms: int | None = None, suspend_task_after_num_failures: int | None = None, config: dict[str, Any] | None = None, session_parameters: dict[str, Any] | None = None, stage_location: str | None = None, imports: list[str | tuple[str, str]] | None = None, packages: list[str | ModuleType] | None = None, use_func_return_value: bool = False, condition: str | None = None)¶
Bases:
objectA graph of tasks composed of a single root task and additional tasks, organized by their dependencies.
Snowflake doesn’t have a first-class task graph entity, so this is a client-side object representation which manages Task relationship. A root
Taskand its successors logically form a task graph or DAG (Directed Acyclic Graph). Refer to Task graphs.When a task graph is deployed, all child tasks are created in Snowflake. A dummy Task is created as the root. A task’s predecessor is the dummy task if it’s added to the task graph with no other predecessors.
Example
Refer to
snowflake.core.task.Taskfor the details of each property.Attributes
- allow_overlapping_execution¶
Legacy boolean view of whether overlapping runs are allowed for the root task.
The configured
overlap_policy(when present) is the source of truth for this property.- Returns:
False— overlapping runs are not allowed (NO_OVERLAP).True— child tasks may overlap across runs (ALLOW_CHILD_OVERLAP).None— unset, or overlap behavior has no legacy boolean equivalent (for exampleALLOW_ALL_OVERLAP), oroverlap_policywas never set.
- Return type:
bool or None
- effective_overlap_policy¶
Effective overlap policy for the root task after applying client-side defaults.
- Returns:
overlap_policywhen set; otherwiseOverlapPolicy.NO_OVERLAP.- Return type:
- overlap_policy¶
Snowflake overlap policy for the root task of this task graph.
When you need a non-optional policy, use
effective_overlap_policy, which treats an unsetoverlap_policyasOverlapPolicy.NO_OVERLAPon this object.- Returns:
The configured policy, or
Noneif unset on this object.- Return type:
OverlapPolicy or None
- tasks¶
Returns a list of tasks this task graph has.
Methods
- add_task(task: DAGTask) None¶
Add a child task to this task graph.
- Parameters:
task (DAGTask) – The child task to be added to this task graph.
Examples
Add a task to previously created DAG