:py:mod:`astronomer.providers.snowflake.triggers.snowflake_trigger` =================================================================== .. py:module:: astronomer.providers.snowflake.triggers.snowflake_trigger Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: astronomer.providers.snowflake.triggers.snowflake_trigger.SnowflakeTrigger astronomer.providers.snowflake.triggers.snowflake_trigger.SnowflakeSqlApiTrigger astronomer.providers.snowflake.triggers.snowflake_trigger.SnowflakeSensorTrigger Functions ~~~~~~~~~ .. autoapisummary:: astronomer.providers.snowflake.triggers.snowflake_trigger.get_db_hook .. py:function:: get_db_hook(snowflake_conn_id) Create and return SnowflakeHookAsync. :return: a SnowflakeHookAsync instance. .. py:class:: SnowflakeTrigger(task_id, poll_interval, query_ids, snowflake_conn_id) Bases: :py:obj:`airflow.triggers.base.BaseTrigger` Snowflake Trigger inherits from the BaseTrigger,it is fired as deferred class with params to run the task in trigger worker and fetch the status for the query ids passed :param task_id: Reference to task id of the Dag :param poll_interval: polling period in seconds to check for the status :param query_ids: List of Query ids to run and poll for the status :param snowflake_conn_id: Reference to Snowflake connection id .. py:method:: serialize() Serializes SnowflakeTrigger arguments and classpath. .. py:method:: run() :async: Makes a series of connections to snowflake to get the status of the query by async get_query_status function .. py:class:: SnowflakeSqlApiTrigger(poll_interval, query_ids, snowflake_conn_id, token_life_time, token_renewal_delta) Bases: :py:obj:`airflow.triggers.base.BaseTrigger` SnowflakeSqlApi Trigger inherits from the BaseTrigger,it is fired as deferred class with params to run the task in trigger worker and fetch the status for the query ids passed :param task_id: Reference to task id of the Dag :param poll_interval: polling period in seconds to check for the status :param query_ids: List of Query ids to run and poll for the status :param snowflake_conn_id: Reference to Snowflake connection id .. py:method:: serialize() Serializes SnowflakeSqlApiTrigger arguments and classpath. .. py:method:: run() :async: Makes a GET API request to snowflake with query_id to get the status of the query by get_sql_api_query_status async function .. py:method:: is_still_running(query_id) :async: Async function to check whether the query statement submitted via SQL API is still running state and returns True if it is still running else return False .. py:class:: SnowflakeSensorTrigger(sql, dag_id, task_id, run_id, snowflake_conn_id, parameters = None, success = None, failure = None, fail_on_empty = False, poke_interval = 60) Bases: :py:obj:`airflow.triggers.base.BaseTrigger` This trigger validates the result of a query (asynchronously). An Airflow Trigger asynchronously polls for a certain condition to be true (which yields a ``TriggerEvent``), after which a synchronous piece of code can be used to complete the logic (set by ``method_name`` on AsyncOperator/Sensor.defer()). Docs: https://airflow.apache.org/docs/apache-airflow/stable/concepts/deferring.html#triggering-deferral .. py:method:: serialize() Serializes SqlTrigger arguments and classpath.. .. py:method:: validate_result(result) Validates query result and verifies if it returns a row .. py:method:: run() :async: Make an asynchronous connection to Snowflake and defer until query returns a result