Module Contents



A client to interact with Snowflake.

class airflow.providers.snowflake.hooks.snowflake.SnowflakeHook(*args, **kwargs)[source]

Bases: airflow.hooks.dbapi.DbApiHook

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.

  • 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> 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

  • insecure_mode -- Turns off OCSP certificate checks. For details, see: How To: Turn Off OCSP Checking in Snowflake Client Drivers - Snowflake Community


get_sqlalchemy_engine() depends on snowflake-sqlalchemy

See also

For more information on how to use this Snowflake connection, take a look at the guide: SnowflakeOperator

conn_name_attr = snowflake_conn_id[source]
default_conn_name = snowflake_default[source]
conn_type = snowflake[source]
hook_name = Snowflake[source]
supports_autocommit = True[source]
static get_connection_form_widgets()[source]

Returns connection widgets to add to connection form

static get_ui_field_behaviour()[source]

Returns custom field behaviour


Override DbApiHook get_uri method for get_sqlalchemy_engine()


Returns a snowflake.connection object

get_sqlalchemy_engine(self, engine_kwargs=None)[source]

Get an sqlalchemy_engine object.


engine_kwargs -- Kwargs used in create_engine().


the created engine.

set_autocommit(self, conn, autocommit)[source]

Sets the autocommit flag on the connection

get_autocommit(self, conn)[source]

Get autocommit setting for the provided connection. Return True if conn.autocommit is set to True. Return False if conn.autocommit is not set or set to False or conn does not support autocommit.


conn -- Connection to get autocommit setting from.


connection autocommit setting.

Return type


run(self, sql, autocommit=False, parameters=None, handler=None)[source]

Runs a command or a list of commands. Pass a list of sql statements to the sql parameter to get them to execute sequentially. The variable execution_info is returned so that it can be used in the Operators to modify the behavior depending on the result of the query (i.e fail the operator if the copy has processed 0 files)

  • sql (Union[str, list]) -- 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 (Optional[Union[Sequence[Any], Dict[Any, Any]]]) -- The parameters to render the SQL query with.

  • handler (Optional[Callable]) -- The result handler which is called with the result of each statement.


Test the Snowflake connection by running a simple query.

Was this entry helpful?