| :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 snowflake_conn_id: Reference to |
| :ref:`Snowflake connection id<howto/connection:snowflake>` |
| :type snowflake_conn_id: str |
| :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) |
| |
| |
| |
| |
| .. method:: run(self, sql: Union[str, list], autocommit: bool = False, parameters: Optional[dict] = None) |
| |
| Runs a command or a list of commands. Pass a list of sql |
| statements to the sql parameter to get them to execute |
| sequentially |
| |
| :param sql: the sql string to be executed with possibly multiple statements, |
| or a list of sql statements to execute |
| :type sql: str or list |
| :param autocommit: What to set the connection's autocommit setting to |
| before executing the query. |
| :type autocommit: bool |
| :param parameters: The parameters to render the SQL query with. |
| :type parameters: dict or iterable |
| |
| |
| |
| |