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}
role_idstringThe part of the name, chosen by the user when the resource was created.
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_nameGet a Synced Table.
createinsertparent, deployment_name, rolereplace_existing, role_idCreates a new Postgres role in the branch.
deletedeletename, deployment_nameDelete a Synced Table.

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 name of the synced table, of the format "synced_tables/{catalog}.{schema}.{table}", where (catalog, schema, table) are the UC entity names.
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.
replace_existingbooleanIf true, update the role if it already exists instead of returning an error. When the role already exists, the provided role spec fully replaces the existing one: membership_roles is overwritten, not merged. Leaving membership_roles empty clears all of the role's existing memberships, including DATABRICKS_SUPERUSER. Always send the complete desired list of memberships when using this field.
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,
role_id,
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,
replace_existing,
role_id
)
SELECT
'{{ role }}' /* required */,
'{{ parent }}',
'{{ deployment_name }}',
'{{ replace_existing }}',
'{{ role_id }}'
;

DELETE examples

Delete a Synced Table.

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