blob: 3cc6ca8ddcaad3a30116b25166fb8c4ad27066af [file] [log] [blame]
:mod:`airflow.providers.snowflake.hooks.snowflake`
==================================================
.. py:module:: airflow.providers.snowflake.hooks.snowflake
Module Contents
---------------
.. py:class:: SnowflakeHook(*args, **kwargs)
Bases: :class:`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. If used with the S3ToSnowflakeOperator
add 'aws_access_key_id' and 'aws_secret_access_key' to extra field in the connection.
:param account: snowflake account name
:type account: Optional[str]
:param 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.
:type authenticator: Optional[str]
:param warehouse: name of snowflake warehouse
:type warehouse: Optional[str]
:param database: name of snowflake database
:type database: Optional[str]
:param region: name of snowflake region
:type region: Optional[str]
:param role: name of snowflake role
:type role: Optional[str]
:param schema: name of snowflake schema
:type schema: Optional[str]
:param session_parameters: You can set session-level parameters at
the time you connect to Snowflake
:type session_parameters: Optional[dict]
.. note::
get_sqlalchemy_engine() depends on snowflake-sqlalchemy
.. seealso::
For more information on how to use this Snowflake connection, take a look at the guide:
:ref:`howto/operator:SnowflakeOperator`
.. attribute:: conn_name_attr
:annotation: = snowflake_conn_id
.. attribute:: default_conn_name
:annotation: = snowflake_default
.. attribute:: conn_type
:annotation: = snowflake
.. attribute:: hook_name
:annotation: = Snowflake
.. attribute:: supports_autocommit
:annotation: = True
.. staticmethod:: get_connection_form_widgets()
Returns connection widgets to add to connection form
.. staticmethod:: get_ui_field_behaviour()
Returns custom field behaviour
.. method:: _get_conn_params(self)
One method to fetch connection params as a dict
used in get_uri() and get_connection()
.. method:: get_uri(self)
Override DbApiHook get_uri method for get_sqlalchemy_engine()
.. method:: get_conn(self)
Returns a snowflake.connection object
.. method:: _get_aws_credentials(self)
Returns aws_access_key_id, aws_secret_access_key
from extra
intended to be used by external import and export statements
.. method:: set_autocommit(self, conn, autocommit: Any)
.. method:: get_autocommit(self, conn)