Interface TaskRef

  • All Known Implementing Classes:
    DefaultTaskRef

    public interface TaskRef
    An interface that allows user to interact with Snowflake tasks.
    • Method Detail

      • name

        ObjectName name()
        Returns:
        name of the referenced task
      • execute

        void execute()
        Executes immediately the referenced task.

        Throws SnowflakeSQLException if 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 SnowflakeSQLException if 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 SnowflakeSQLException not authorized.

      • suspend

        void suspend()
        Suspends running referenced task.

        If the task is already suspended - the operation is ignored.

        Throws SnowflakeSQLException if 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 SnowflakeSQLException if not authorized.

      • drop

        void drop()
        Removes referenced task from the database.

        Current execution of the task is finished before the task is dropped.

        Throws SnowflakeSQLException if 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 SnowflakeSQLException if task does not exist or not authorized.

      • alterSchedule

        void alterSchedule​(String schedule)
        Changes schedule of referenced task.

        Throws SnowflakeSQLException if 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 SnowflakeSQLException if 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 SnowflakeSQLException if 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 SnowflakeSQLException if 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 SnowflakeSQLException if 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 SnowflakeSQLException if 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 for TaskRef.
        Parameters:
        session - Snowpark session object
        objectName - Task reference name
        Returns:
        TaskRef instance