astronomer.providers.snowflake.triggers.snowflake_trigger

Classes

SnowflakeTrigger

Snowflake Trigger inherits from the BaseTrigger,it is fired as

SnowflakeSqlApiTrigger

This class is deprecated and will be removed in 2.0.0.

SnowflakeSensorTrigger

This trigger validates the result of a query (asynchronously).

Functions

get_db_hook(snowflake_conn_id)

Create and return SnowflakeHookAsync.

Module Contents

astronomer.providers.snowflake.triggers.snowflake_trigger.get_db_hook(snowflake_conn_id)[source]

Create and return SnowflakeHookAsync. :return: a SnowflakeHookAsync instance.

class astronomer.providers.snowflake.triggers.snowflake_trigger.SnowflakeTrigger(task_id, poll_interval, query_ids, snowflake_conn_id)[source]

Bases: 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

Parameters:
  • task_id (str) – Reference to task id of the Dag

  • poll_interval (float) – polling period in seconds to check for the status

  • query_ids (list[str]) – List of Query ids to run and poll for the status

  • snowflake_conn_id (str) – Reference to Snowflake connection id

task_id
poll_interval
query_ids
snowflake_conn_id
serialize()[source]

Serializes SnowflakeTrigger arguments and classpath.

async run()[source]

Makes a series of connections to snowflake to get the status of the query by async get_query_status function

class astronomer.providers.snowflake.triggers.snowflake_trigger.SnowflakeSqlApiTrigger(poll_interval, query_ids, snowflake_conn_id, token_life_time, token_renewal_delta)[source]

Bases: airflow.triggers.base.BaseTrigger

This class is deprecated and will be removed in 2.0.0. Use :class: ~airflow.providers.snowflake.triggers.snowflake_trigger.SnowflakeSqlApiTrigger instead.

poll_interval
query_ids
snowflake_conn_id
token_life_time
token_renewal_delta
serialize()[source]

Serializes SnowflakeSqlApiTrigger arguments and classpath.

async run()[source]

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

async is_still_running(query_id)[source]

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

class astronomer.providers.snowflake.triggers.snowflake_trigger.SnowflakeSensorTrigger(sql, dag_id, task_id, run_id, snowflake_conn_id, parameters=None, success=None, failure=None, fail_on_empty=False, poke_interval=60)[source]

Bases: 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

serialize()[source]

Serializes SqlTrigger arguments and classpath..

async run()[source]

Make an asynchronous connection to Snowflake and defer until query returns a result