Airflow Summit 2025 is coming October 07-09. Register now for early bird ticket!

airflow.providers.snowflake.utils.sql_api_generate_jwt

Attributes

Classes

JWTGenerator

Creates and signs a JWT with the specified private key file, username, and account identifier.

Module Contents

airflow.providers.snowflake.utils.sql_api_generate_jwt.logger[source]
airflow.providers.snowflake.utils.sql_api_generate_jwt.ISSUER = 'iss'[source]
airflow.providers.snowflake.utils.sql_api_generate_jwt.EXPIRE_TIME = 'exp'[source]
airflow.providers.snowflake.utils.sql_api_generate_jwt.ISSUE_TIME = 'iat'[source]
airflow.providers.snowflake.utils.sql_api_generate_jwt.SUBJECT = 'sub'[source]
class airflow.providers.snowflake.utils.sql_api_generate_jwt.JWTGenerator(account, user, private_key, lifetime=LIFETIME, renewal_delay=RENEWAL_DELTA)[source]

Creates and signs a JWT with the specified private key file, username, and account identifier.

The JWTGenerator keeps the generated token and only regenerates the token if a specified period of time has passed.

Creates an object that generates JWTs for the specified user, account identifier, and private key

Parameters:
LIFETIME[source]
RENEWAL_DELTA[source]
ALGORITHM = 'RS256'[source]
account[source]
user[source]
qualified_username[source]
lifetime[source]
renewal_delay[source]
private_key[source]
renew_time[source]
token: str | None = None[source]
prepare_account_name_for_jwt(raw_account)[source]

Prepare the account identifier for use in the JWT.

For the JWT, the account identifier must not include the subdomain or any region or cloud provider information.

Parameters:

raw_account (str) – The specified account identifier.

get_token()[source]

Generate a new JWT.

If a JWT has been already been generated earlier, return the previously generated token unless the specified renewal time has passed.

calculate_public_key_fingerprint(private_key)[source]

Given a private key in PEM format, return the public key fingerprint.

Parameters:

private_key (Any) – private key

Was this entry helpful?