airflow.providers.snowflake.operators.snowflake

Module Contents

class airflow.providers.snowflake.operators.snowflake.SnowflakeOperator(*, sql: Any, snowflake_conn_id: str = 'snowflake_default', parameters: Optional[dict] = None, autocommit: bool = True, warehouse: Optional[str] = None, database: Optional[str] = None, role: Optional[str] = None, schema: Optional[str] = None, authenticator: Optional[str] = None, session_parameters: Optional[dict] = None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Executes SQL code in a Snowflake database

See also

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

Parameters
  • snowflake_conn_id (str) -- Reference to Snowflake connection id

  • sql (Can receive a str representing a sql statement, a list of str (sql statements), or reference to a template file. Template reference are recognized by str ending in '.sql') -- the sql code to be executed. (templated)

  • autocommit (bool) -- if True, each command is automatically committed. (default value: True)

  • parameters (dict or iterable) -- (optional) the parameters to render the SQL query with.

  • warehouse (str) -- name of warehouse (will overwrite any warehouse defined in the connection's extra JSON)

  • database (str) -- name of database (will overwrite database defined in connection)

  • schema (str) -- name of schema (will overwrite schema defined in connection)

  • role (str) -- name of role (will overwrite any role defined in connection's extra JSON)

  • authenticator (str) -- 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.

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

template_fields = ['sql'][source]
template_ext = ['.sql'][source]
ui_color = #ededed[source]
get_hook(self)[source]

Create and return SnowflakeHook. :return: a SnowflakeHook instance. :rtype: SnowflakeHook

execute(self, context: Any)[source]

Run query on snowflake

Was this entry helpful?