Skip to main content

database_instance_roles

Creates, updates, deletes, gets or lists a database_instance_roles resource.

Overview

Namedatabase_instance_roles
TypeResource
Iddatabricks_workspace.database.database_instance_roles

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the role. This is the unique identifier for the role in an instance.
instance_namestring
attributesobjectThe desired API-exposed Postgres role attribute to associate with the role. Optional.
effective_attributesobjectThe attributes that are applied to the role. This is an output only field that contains the value computed from the input field combined with server side defaults. Use the field without the effective_ prefix to set the value.
identity_typestringThe type of the role. (GROUP, PG_ONLY, SERVICE_PRINCIPAL, USER)
membership_rolestringAn enum value for a standard role that this role is a member of. (DATABRICKS_SUPERUSER)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectinstance_name, name, deployment_nameGets a role for a Database Instance.
listselectinstance_name, deployment_namepage_size, page_tokenSTART OF PG ROLE APIs Section These APIs are marked a PUBLIC with stage < PUBLIC_PREVIEW. With more
createinsertinstance_name, deployment_name, database_instance_roledatabase_instance_nameCreate a role for a Database Instance.
deletedeleteinstance_name, name, deployment_nameallow_missing, reassign_owned_toDeletes a role for a Database Instance.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
instance_namestring:param name: str
namestring
allow_missingbooleanThis is the AIP standard name for the equivalent of Postgres' IF EXISTS option
database_instance_namestring:returns: :class:DatabaseInstanceRole
page_sizeinteger
page_tokenstringPagination token to go to the next page of Database Instances. Requests first page if absent.
reassign_owned_tostringstr (optional)

SELECT examples

Gets a role for a Database Instance.

SELECT
name,
instance_name,
attributes,
effective_attributes,
identity_type,
membership_role
FROM databricks_workspace.database.database_instance_roles
WHERE instance_name = '{{ instance_name }}' -- required
AND name = '{{ name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Create a role for a Database Instance.

INSERT INTO databricks_workspace.database.database_instance_roles (
database_instance_role,
instance_name,
deployment_name,
database_instance_name
)
SELECT
'{{ database_instance_role }}' /* required */,
'{{ instance_name }}',
'{{ deployment_name }}',
'{{ database_instance_name }}'
RETURNING
name,
instance_name,
attributes,
effective_attributes,
identity_type,
membership_role
;

DELETE examples

Deletes a role for a Database Instance.

DELETE FROM databricks_workspace.database.database_instance_roles
WHERE instance_name = '{{ instance_name }}' --required
AND name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND allow_missing = '{{ allow_missing }}'
AND reassign_owned_to = '{{ reassign_owned_to }}'
;