astronomer.providers.snowflake.sensors.snowflake

Module Contents

Classes

SnowflakeSensorAsync

Runs a sql statement repeatedly until a criteria is met. It will keep trying until

class astronomer.providers.snowflake.sensors.snowflake.SnowflakeSensorAsync(*, snowflake_conn_id, sql, parameters=None, success=None, failure=None, fail_on_empty=False, hook_params=None, **kwargs)[source]

Bases: airflow.providers.common.sql.sensors.sql.SqlSensor

Runs a sql statement repeatedly until a criteria is met. It will keep trying until success or failure criteria are met, or if the first cell returned from the query is not in (0, ‘0’, ‘’, None). Optional success and failure callables are called with the first cell returned from the query as the argument. If success callable is defined the sensor will keep retrying until the criteria is met. If failure callable is defined and the criteria is met the sensor will raise AirflowException. Failure criteria is evaluated before success criteria. A fail_on_empty boolean can also be passed to the sensor in which case it will fail if no rows have been returned.

Parameters:
  • snowflake_conn_id (str) – The connection to run the sensor against

  • sql (str) – The sql to run. To pass, it needs to return at least one cell that contains a non-zero / empty string value.

  • parameters (str | None) – The parameters to render the SQL query with (optional).

  • success (str | None) – Success criteria for the sensor is a Callable that takes the first cell returned from the query as the only argument, and returns a boolean (optional).

  • failure (str | None) – Failure criteria for the sensor is a Callable that takes the first cell returned from the query as the only argument and return a boolean (optional).

  • fail_on_empty (bool) – Explicitly fail on no rows returned.

  • hook_params (dict[str, Any] | None) – Extra config params to be passed to the underlying hook. Should match the desired hook constructor params.

template_fields: Sequence[str] = ('sql',)
template_ext: Sequence[str] = ('.sql',)
ui_color = '#7c7287'
execute(context)[source]

Check for query result in Snowflake by deferring using the trigger

execute_complete(context, event=None)[source]

Callback for when the trigger fires - returns immediately. Relies on trigger to throw an exception, otherwise it assumes execution was successful.