Skip to content

Secrets

Module for retrieving secrets from DataBricks Scopes.

Secrets are stored as SecretContext and can be accessed accordingly.

See DataBricksSecret for more information.

koheesio.integrations.spark.databricks.secrets.DataBricksSecret #

Retrieve secrets from DataBricks secret scope and wrap them into Context class for easy access. All secrets are stored under the "secret" root and "parent". "Parent" either derived from the secure scope by replacing "/" and "-", or manually provided by the user. Secrets are wrapped into the pydantic.SecretStr.

Examples:

context = {"secrets": {"parent": {"webhook": SecretStr("**********"), "description": SecretStr("**********")}}}

Values can be decoded like this:

context.secrets.parent.webhook.get_secret_value()
or if working with dictionary is preferable:
for key, value in context.get_all().items():
    value.get_secret_value()

alias class-attribute instance-attribute #

alias: Optional[Dict[str, str]] = Field(
    default_factory=dict,
    description="Alias for secret keys",
)

scope class-attribute instance-attribute #

scope: str = Field(description='Scope')