Skip to main content

prefect_snowflake.credentials

Credentials block for authenticating with Snowflake.

Classes

InvalidPemFormat

Invalid PEM Format Certificate

SnowflakeCredentials

Block used to manage authentication with Snowflake. Args:
  • account: The snowflake account name.
  • user: The user name used to authenticate.
  • password: The password used to authenticate.
  • private_key: The PEM used to authenticate.
  • authenticator: The type of authenticator to use for initializing connection (oauth, externalbrowser, etc); refer to Snowflake documentation for details, and note that externalbrowser will only work in an environment where a browser is available.
  • workload_identity_provider: The workload identity provider to use when authenticator is set to workload_identity.
  • token: The OAuth or JWT Token to provide when authenticator is set to oauth, or workload_identity_provider is set to oidc.
  • endpoint: The Okta endpoint to use when authenticator is set to okta_endpoint, e.g. https\://<okta_account_name>.okta.com.
  • role: The name of the default role to use.
  • autocommit: Whether to automatically commit.
Methods:

get_client

get_client(self, **connect_kwargs: Any) -> snowflake.connector.SnowflakeConnection
Returns an authenticated connection that can be used to query Snowflake databases. Any additional arguments passed to this method will be used to configure the SnowflakeConnection. For available parameters, please refer to the Snowflake Python connector documentation. Args:
  • **connect_kwargs: Additional arguments to pass to snowflake.connector.connect.
Returns:
  • An authenticated Snowflake connection.

resolve_private_key

resolve_private_key(self) -> bytes | None
Converts a PEM encoded private key into a DER binary key. Returns:
  • DER encoded key if private_key has been provided otherwise returns None.
Raises:
  • InvalidPemFormat: If private key is not in PEM format.