Back to Prefect

credentials

docs/integrations/prefect-snowflake/api-ref/prefect_snowflake-credentials.mdx

3.6.30.dev33.0 KB
Original Source

prefect_snowflake.credentials

Credentials block for authenticating with Snowflake.

Classes

InvalidPemFormat <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-snowflake/prefect_snowflake/credentials.py#L39" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Invalid PEM Format Certificate

SnowflakeCredentials <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-snowflake/prefect_snowflake/credentials.py#L43" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-snowflake/prefect_snowflake/credentials.py#L344" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-snowflake/prefect_snowflake/credentials.py#L246" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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.