Skip to main content

Database Credential

View as Markdown

A short-lived credential for connecting to database instances with the caller's Databricks identity.

DatabaseCredential object​

A short-lived credential for connecting to database instances with the caller's Databricks identity.

tokenstringPublic Preview

The OAuth token to use as the Postgres password when connecting to a database instance.

expiration_timestringPublic Preview

The time at which the token expires. Tokens are valid for one hour after they are issued, and a new token is needed to open connections after that time.

Generates a credential that can be used to access database instances Public Preview​

POST /api/2.0/database/credentials

Generates a short-lived OAuth token for connecting to database instances. Connect with the caller's Databricks identity as the Postgres user and the returned token as the password. For details about OAuth token authentication, see About authentication.

For new workloads, Databricks recommends the Postgres API equivalent: Generate a database credential.

API scopes: postgres

CloudsAWSAzure

Request body​

request_idstring

A client-generated identifier for this request, such as a UUID. The request fails when it is omitted.

instance_namesarray of string

Names of the database instances to connect to with the credential. Every named instance must exist in the workspace, or the request fails. At least one of instance_names or claims must be specified.

claimsarray of object

Unity Catalog permissions to embed in the credential. Databricks verifies that the caller holds each permission in Unity Catalog and records a reference to it in the token. When the user connects, Postgres grants them the matching privileges on the Postgres objects that back those Unity Catalog resources. Each resource must have a Postgres counterpart, such as a synced table or a table in a database catalog.

Show child attributesHide child attributes
permission_setstring

The level of access that the credential grants on the listed resources. READ_ONLY covers SELECT on each table, along with USE SCHEMA on its schema and USE CATALOG on its catalog.

Values:

  • READ_ONLY
resourcesarray of object

The Unity Catalog resources that the permission set applies to.

Show child attributesHide child attributes
unspecified_resource_namestring
table_namestring

The full three-level Unity Catalog name of the database table or synced table, in the form catalog.schema.table.

Example: main.sales.orders

Response​

Returns the DatabaseCredential object.