Interface TaskRef
-
- All Known Implementing Classes:
DefaultTaskRef
public interface TaskRefAn interface that allows user to interact with Snowflake tasks.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidalterSchedule(String schedule)Changes schedule of referenced task.voidalterScheduleIfExists(String schedule)Changes schedule of referenced task if it exists.voidalterWarehouse(String warehouse)Changes warehouse of referenced task.voidalterWarehouseIfExists(String warehouse)Changes warehouse of referenced task if it exists.booleancheckIfExists()voiddrop()Removes referenced task from the database.voiddropIfExists()Removes referenced task from the database if it exists.voidexecute()Executes immediately the referenced task.TaskPropertiesfetch()Fetches properties containing base information about the referenced task.voidgrantMonitorPrivilegeToRole(String role)Grants monitor privilege to given application role.ObjectNamename()static TaskRefof(Session session, ObjectName objectName)Returns a new instance of the default implementation forTaskRef.voidresume()Resumes suspended referenced task.voidresumeIfExists()Resumes suspended referenced task if it exists.voidsuspend()Suspends running referenced task.voidsuspendIfExists()Suspends running referenced task if it exists.
-
-
-
Method Detail
-
name
ObjectName name()
- Returns:
- name of the referenced task
-
execute
void execute()
Executes immediately the referenced task.Throws
SnowflakeSQLExceptionif task does not exist or not authorized.
-
checkIfExists
boolean checkIfExists()
- Returns:
- true if task can be matched with a task existing in Snowflake database, otherwise false
-
resume
void resume()
Resumes suspended referenced task.If the task is already resumed - the operation is ignored.
Throws
SnowflakeSQLExceptionif task does not exist or not authorized.
-
resumeIfExists
void resumeIfExists()
Resumes suspended referenced task if it exists.If the task is already resumed - the operation is ignored.
Throws
SnowflakeSQLExceptionnot authorized.
-
suspend
void suspend()
Suspends running referenced task.If the task is already suspended - the operation is ignored.
Throws
SnowflakeSQLExceptionif task does not exist or not authorized.
-
suspendIfExists
void suspendIfExists()
Suspends running referenced task if it exists.If the task is already suspended - the operation is ignored.
Throws
SnowflakeSQLExceptionif not authorized.
-
drop
void drop()
Removes referenced task from the database.Current execution of the task is finished before the task is dropped.
Throws
SnowflakeSQLExceptionif task does not exist or not authorized.
-
dropIfExists
void dropIfExists()
Removes referenced task from the database if it exists.Current execution of the task is finished before the task is dropped.
Throws
SnowflakeSQLExceptionif task does not exist or not authorized.
-
alterSchedule
void alterSchedule(String schedule)
Changes schedule of referenced task.Throws
SnowflakeSQLExceptionif task does not exist, not authorized, or schedule is invalid.- Parameters:
schedule- interval or cron expression which will be set
-
alterScheduleIfExists
void alterScheduleIfExists(String schedule)
Changes schedule of referenced task if it exists.Throws
SnowflakeSQLExceptionif task does not exist, not authorized, or schedule is invalid.- Parameters:
schedule- interval or cron expression which will be set
-
alterWarehouse
void alterWarehouse(String warehouse)
Changes warehouse of referenced task.Throws
SnowflakeSQLExceptionif task does not exist, not authorized, or warehouse name is invalid.- Parameters:
warehouse- warehouse name which will be set
-
alterWarehouseIfExists
void alterWarehouseIfExists(String warehouse)
Changes warehouse of referenced task if it exists.Throws
SnowflakeSQLExceptionif task does not exist, not authorized, or warehouse name is invalid.- Parameters:
warehouse- warehouse name which will be set
-
grantMonitorPrivilegeToRole
void grantMonitorPrivilegeToRole(String role)
Grants monitor privilege to given application role.Throws
SnowflakeSQLExceptionif task does not exist, not authorized, or role is invalid.- Parameters:
role- role which will be granted monitor privilege
-
fetch
TaskProperties fetch()
Fetches properties containing base information about the referenced task.Throws
SnowflakeSQLExceptionif task does not exist or not authorized.- Returns:
- properties of the referenced task
-
of
static TaskRef of(Session session, ObjectName objectName)
Returns a new instance of the default implementation forTaskRef.- Parameters:
session- Snowpark session objectobjectName- Task reference name- Returns:
TaskRefinstance
-
-