astronomer.providers.snowflake.operators.snowflake
¶
Module Contents¶
Classes¶
Executes SQL code in a Snowflake database |
|
Implemented Async Snowflake SQL API Operator to support multiple SQL statements sequentially, |
- class astronomer.providers.snowflake.operators.snowflake.SnowflakeOperatorAsync(*, poll_interval=5, **kwargs)[source]¶
Bases:
airflow.providers.snowflake.operators.snowflake.SnowflakeOperator
Executes SQL code in a Snowflake database
- Parameters:
snowflake_conn_id – Reference to Snowflake connection id
sql – the sql code to be executed. (templated)
autocommit – if True, each command is automatically committed. (default value: True)
parameters – (optional) the parameters to render the SQL query with.
warehouse – name of warehouse (will overwrite any warehouse defined in the connection’s extra JSON)
database – name of database (will overwrite database defined in connection)
schema – name of schema (will overwrite schema defined in connection)
role – name of role (will overwrite any role defined in connection’s extra JSON)
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.
session_parameters – You can set session-level parameters at the time you connect to Snowflake
poll_interval (int) – the interval in seconds to poll the query
- class astronomer.providers.snowflake.operators.snowflake.SnowflakeSqlApiOperatorAsync(*, poll_interval=5, statement_count=0, token_life_time=LIFETIME, token_renewal_delta=RENEWAL_DELTA, bindings=None, **kwargs)[source]¶
Bases:
airflow.providers.snowflake.operators.snowflake.SnowflakeOperator
Implemented Async Snowflake SQL API Operator to support multiple SQL statements sequentially, which is the behavior of the SnowflakeOperator, the Snowflake SQL API allows submitting multiple SQL statements in a single request. In combination with aiohttp, make post request to submit SQL statements for execution, poll to check the status of the execution of a statement. Fetch query results concurrently. This Operator currently uses key pair authentication, so you need tp provide private key raw content or private key file path in the snowflake connection along with other details
- where can this operator fit in?
To Execute Multiple SQL statement in single request
To Execute the SQL statement asynchronously and to execute standard queries and most DDL and DML statements
To develop custom applications and integrations that perform queries
To create provision users and roles, create table, etc.
- The following commands are not supported:
The PUT command (in Snowflake SQL)
The GET command (in Snowflake SQL)
The CALL command with stored procedures that return a table(stored procedures with the RETURNS TABLE clause).
- Parameters:
snowflake_conn_id – Reference to Snowflake connection id
sql – the sql code to be executed. (templated)
autocommit – if True, each command is automatically committed. (default value: True)
parameters – (optional) the parameters to render the SQL query with.
warehouse – name of warehouse (will overwrite any warehouse defined in the connection’s extra JSON)
database – name of database (will overwrite database defined in connection)
schema – name of schema (will overwrite schema defined in connection)
role – name of role (will overwrite any role defined in connection’s extra JSON)
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.
session_parameters – You can set session-level parameters at the time you connect to Snowflake
poll_interval (int) – the interval in seconds to poll the query
statement_count (int) – Number of SQL statement to be executed
token_life_time (datetime.timedelta) – lifetime of the JWT Token
token_renewal_delta (datetime.timedelta) – Renewal time of the JWT Token
bindings (Optional[Dict[str, Any]]) – (Optional) Values of bind variables in the SQL statement. When executing the statement, Snowflake replaces placeholders (? and :name) in the statement with these specified values.
- LIFETIME¶
- RENEWAL_DELTA¶