You are viewing documentation about an older version (0.1.3). View latest version

snowflake.core.task.Task

class snowflake.core.task.Task(name: str, definition: str | StoredProcedureCall, *, warehouse: str | None = None, user_task_managed_initial_warehouse_size: str | None = None, suspend_task_after_num_failures: int | None = None, user_task_timeout_ms: int | None = None, schedule: Cron | timedelta | None = None, allow_overlapping_execution: bool | None = None, error_integration: str | None = None, comment: str | None = None, predecessors: List[str] | None = None, condition: str | None = None, id: str | None = None, created_on: datetime | None = None, last_committed_on: datetime | None = None, last_suspended_on: datetime | None = None, state: str | None = None, database_name: str | None = None, schema_name: str | None = None, owner: str | None = None, owner_role_type: str | None = None, local_parameters: Dict[str, Any] | None = None, effective_parameters: Dict[str, Dict[str, str | bool | int | float]] | None = None)

Bases: object

Represents a Snowflake Task.

Attributes

sql_definition

The definition of the task in SQL text.

It’s a readonly property. To set the definition of the Task, use definition.

If definition is a StoredProcedureCall, the SQL that calls the stored procedure, or the

anonymous stored procedure definition will be returned.

name: str

Name of the task.

definition: str | StoredProcedureCall

Definition of the task.

Any one of the following:
  • A SQL Statement. It can be a single SQL statement, or a procedural logic using Snowflake Scripting.

  • A StoredProcedureCall instance. This provides a Pythonic way to call an existing stored procedure, or use a Snowflake annonymous stored procedure in Python.

schedule

The schedule for periodically running the task. The minimum schedule is 1 minute.

user_task_timeout_ms

Specifies the time limit on a single run of the task before it times out (in milliseconds).

allow_overlapping_execution

Whether to allow multiple instances of the DAG to run concurrently.

comment

Specifies a comment for the task.

created_on

Date and time when the task was created.

last_suspended_on

Timestamp when the task was last suspended. If the task has not been suspended yet, the value is NULL.

state

“started” or “suspended” based on the current state of the task.

database_name

Database in which the task is stored.

schema_name

Schema in which the task is stored.

owner

Role that owns the task (i.e. has the OWNERSHIP privilege on the task)

effective_parameters

The effective parameters set for this task.

Methods

__init__(name: str, definition: str | StoredProcedureCall, *, warehouse: str | None = None, user_task_managed_initial_warehouse_size: str | None = None, suspend_task_after_num_failures: int | None = None, user_task_timeout_ms: int | None = None, schedule: Cron | timedelta | None = None, allow_overlapping_execution: bool | None = None, error_integration: str | None = None, comment: str | None = None, predecessors: List[str] | None = None, condition: str | None = None, id: str | None = None, created_on: datetime | None = None, last_committed_on: datetime | None = None, last_suspended_on: datetime | None = None, state: str | None = None, database_name: str | None = None, schema_name: str | None = None, owner: str | None = None, owner_role_type: str | None = None, local_parameters: Dict[str, Any] | None = None, effective_parameters: Dict[str, Dict[str, str | bool | int | float]] | None = None) None