Skip to main content

postgres_roles

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

Overview

Namepostgres_roles
TypeResource
Iddatabricks_workspace.postgres.postgres_roles

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringOutput only. The full resource path of the role. Format: projects/{project_id}/branches/{branch_id}/roles/{role_id}
create_timestring (date-time)
parentstringThe Branch where this Role exists. Format: projects/{project_id}/branches/{branch_id}
specobjectThe spec contains the role configuration, including identity type, authentication method, and role attributes.
statusobjectCurrent status of the role, including its identity type, authentication method, and role attributes.
update_timestring (date-time)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectparent, deployment_namepage_size, page_tokenReturns a paginated list of Postgres roles in the branch.
getselectname, deployment_nameRetrieves information about the specified Postgres role, including its authentication method and
createinsertparent, deployment_name, rolerole_idCreates a new Postgres role in the branch.
deletedeletename, deployment_namereassign_owned_toDeletes the specified Postgres role.

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)
namestringThe full resource path of the role to delete. Format: projects/{project_id}/branches/{branch_id}/roles/{role_id}
parentstringThe Branch where this Role is created. Format: projects/{project_id}/branches/{branch_id}
page_sizeintegerUpper bound for items returned. Cannot be negative.
page_tokenstringPage token from a previous response. If not provided, returns the first page.
reassign_owned_tostringReassign objects. If this is set, all objects owned by the role are reassigned to the role specified in this parameter. NOTE: setting this requires spinning up a compute to succeed, since it involves running SQL queries. TODO: #LKB-7187 implement reassign_owned_to on LBM side. This might end-up being a synchronous query when this parameter is used.
role_idstringThe ID to use for the Role, which will become the final component of the role's resource name. This ID becomes the role in Postgres. This value should be 4-63 characters, and valid characters are lowercase letters, numbers, and hyphens, as defined by RFC 1123. If role_id is not specified in the request, it is generated automatically.

SELECT examples

Returns a paginated list of Postgres roles in the branch.

SELECT
name,
create_time,
parent,
spec,
status,
update_time
FROM databricks_workspace.postgres.postgres_roles
WHERE parent = '{{ parent }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;

INSERT examples

Creates a new Postgres role in the branch.

INSERT INTO databricks_workspace.postgres.postgres_roles (
role,
parent,
deployment_name,
role_id
)
SELECT
'{{ role }}' /* required */,
'{{ parent }}',
'{{ deployment_name }}',
'{{ role_id }}'
;

DELETE examples

Deletes the specified Postgres role.

DELETE FROM databricks_workspace.postgres.postgres_roles
WHERE name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND reassign_owned_to = '{{ reassign_owned_to }}'
;