duckdb.set_sp_secret()
Register a service principal as a DuckDB Azure secret.
Usage
duckdb.set_sp_secret(
conn,
tenant_id,
client_id,
client_secret,
account=None,
)As quak::az_set_sp_secret(): PROVIDER service_principal, so DuckDB redeems the client secret itself.
Parameters
conn: duckdb.DuckDBPyConnection-
The DuckDB connection.
tenant_id: str-
The service principal’s tenant.
client_id: str-
Its client (application) ID.
client_secret: str-
Its client secret.
account: str | None = None-
Scope the secret to this storage account’s hosts; it also gets
ACCOUNT_NAME.
Raises
TypeError-
An argument is not a string.
ValueError-
An argument is empty or holds a NUL character.
duckdb.Error- DuckDB refused the statement; the message never carries the secret.
Notes
Delta tables never match an account-scoped secret, so register an unscoped one for them.
Examples
import os
from dazapiz.duckdb import set_sp_secret
set_sp_secret(
conn,
os.environ["AZURE_TENANT_ID"],
os.environ["AZURE_CLIENT_ID"],
os.environ["AZURE_CLIENT_SECRET"],
account="myaccount",
)