snowflake.core.task.TaskCollection¶
- class snowflake.core.task.TaskCollection(schema: SchemaResource)¶
Bases:
SchemaObjectCollectionParent
[TaskResource
]Represents the collection operations of the Snowflake Task resource.
Example
>>> tasks: TaskCollection = root.databases["mydb"].schemas["myschema"].tasks >>> mytask = tasks.create(Task("mytask", definition="select 1")) # returns a TaskResource instance. >>> task_iter = tasks.iter(like="my%")
Attributes
- database¶
- root¶
- schema¶
Methods
- __init__(schema: SchemaResource) None ¶
- create(task: Task, *, mode: CreateMode = CreateMode.error_if_exists) TaskResource ¶
Create a task in the Snowflake database.
- Parameters:
task – an instance of
Task
.mode –
One of the following strings.
CreateMode.error_if_exists: Throw an
snowflake.core.exceptions.ConflictError
if the task already exists in Snowflake. Equivalent to SQLcreate task <name> ...
.CreateMode.or_replace: Replace if the task already exists in Snowflake. Equivalent to SQL
create or replace task <name> ...
.CreateMode.if_not_exists: Do nothing if the task already exists in Snowflake. Equivalent to SQL
create task <name> if not exists...
Default value is CreateMode.error_if_exists.
- items() ItemsView[str, T] ¶
- iter(*, like: str | None = None, starts_with: str | None = None, limit: int | None = None, root_only: bool = False) Iterator[Task] ¶
Search for tasks in Snowflake.
- Parameters:
like – The pattern of the Task name. Use
%
to represent any number of characters and?
for a single character.startswith – The task name starts with this string.
root_only – Look for root tasks only.
- keys() KeysView[str] ¶
- values() ValuesView[T] ¶