astronomer.providers.snowflake.hooks.snowflake

Attributes

ABORTING_MESSAGE

FAILED_WITH_ERROR_MESSAGE

Classes

SnowflakeHookAsync

A client to interact with Snowflake.

Functions

fetch_all_snowflake_handler(cursor)

Handler for SnowflakeCursor to return results

fetch_one_snowflake_handler(cursor)

Handler for SnowflakeCursor to return results

Module Contents

astronomer.providers.snowflake.hooks.snowflake.fetch_all_snowflake_handler(cursor)[source]

Handler for SnowflakeCursor to return results

astronomer.providers.snowflake.hooks.snowflake.fetch_one_snowflake_handler(cursor)[source]

Handler for SnowflakeCursor to return results

astronomer.providers.snowflake.hooks.snowflake.ABORTING_MESSAGE = 'The query is in the process of being aborted on the server side.'
astronomer.providers.snowflake.hooks.snowflake.FAILED_WITH_ERROR_MESSAGE = 'The query finished unsuccessfully.'
class astronomer.providers.snowflake.hooks.snowflake.SnowflakeHookAsync(*args, **kwargs)[source]

Bases: airflow.providers.snowflake.hooks.snowflake.SnowflakeHook

A client to interact with Snowflake.

This hook requires the snowflake_conn_id connection. The snowflake host, login, and, password field must be setup in the connection. Other inputs can be defined in the connection or hook instantiation. If used with the S3ToSnowflakeOperator add ‘aws_access_key_id’ and ‘aws_secret_access_key’ to extra field in the connection.

Parameters:
  • snowflake_conn_id – Reference to Snowflake connection id

  • account – snowflake account name

  • authenticator – authenticator for Snowflake. ‘snowflake’ (default) to use the internal Snowflake authenticator ‘externalbrowser’ to authenticate using your web browser and Okta, ADFS or any other SAML 2.0-compliant identify provider (IdP) that has been defined for your account ‘https://<your_okta_account_name>.okta.com’ to authenticate through native Okta.

  • warehouse – name of snowflake warehouse

  • database – name of snowflake database

  • region – name of snowflake region

  • role – name of snowflake role

  • schema – name of snowflake schema

  • session_parameters – You can set session-level parameters at the time you connect to Snowflake

run(sql, autocommit=True, parameters=None, return_dictionaries=False)[source]

Runs a SQL command or a list of SQL commands.

Parameters:
  • sql (str | list[str]) – the sql string to be executed with possibly multiple statements, or a list of sql statements to execute

  • autocommit (bool) – What to set the connection’s autocommit setting to before executing the query.

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

check_query_output(query_ids, handler=None, return_last=True, return_dictionaries=False)[source]

Once the query is finished fetch the result and log it in airflow

async get_query_status(query_ids, poll_interval)[source]

Get the Query status by query ids.