Skip to main content

postgres_databases

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

Overview

Namepostgres_databases
TypeResource
Iddatabricks_workspace.postgres.postgres_databases

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe resource name of the database. Format: projects/{project_id}/branches/{branch_id}/databases/{database_id}
database_idstringThe part of the name, chosen by the user when the resource was created.
create_timestring (date-time)A timestamp indicating when the database was created.
parentstringThe branch containing this database. Format: projects/{project_id}/branches/{branch_id}
specobjectThe desired state of the Database.
statusobjectThe observed state of the Database.
update_timestring (date-time)A timestamp indicating when the database was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectparent, deployment_namepage_size, page_tokenList Databases.
createinsertparent, deployment_name, databasedatabase_id, replace_existingCreate a Database.

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)
parentstringThe Branch where this Database will be created. Format: projects/{project_id}/branches/{branch_id}
database_idstringThe ID to use for the Database, which will become the final component of the database's resource name. This ID becomes the database name in postgres. This value should be 4-63 characters, and only use characters available in DNS names, as defined by RFC-1123 If database_id is not specified in the request, it is generated automatically.
page_sizeintegerUpper bound for items returned.
page_tokenstringPagination token to go to the next page of Databases. Requests first page if absent.
replace_existingbooleanIf true, update the database if it already exists instead of returning an error.

SELECT examples

List Databases.

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

INSERT examples

Create a Database.

INSERT INTO databricks_workspace.postgres.postgres_databases (
database,
parent,
deployment_name,
database_id,
replace_existing
)
SELECT
'{{ database }}' /* required */,
'{{ parent }}',
'{{ deployment_name }}',
'{{ database_id }}',
'{{ replace_existing }}'
;