postgres_databases
Creates, updates, deletes, gets or lists a postgres_databases resource.
Overview
| Name | postgres_databases |
| Type | Resource |
| Id | databricks_workspace.postgres.postgres_databases |
Fields
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
name | string | The resource name of the database. Format: projects/{project_id}/branches/{branch_id}/databases/{database_id} |
database_id | string | The part of the name, chosen by the user when the resource was created. |
create_time | string (date-time) | A timestamp indicating when the database was created. |
parent | string | The branch containing this database. Format: projects/{project_id}/branches/{branch_id} |
spec | object | The desired state of the Database. |
status | object | The observed state of the Database. |
update_time | string (date-time) | A timestamp indicating when the database was last updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | parent, deployment_name | page_size, page_token | List Databases. |
create | insert | parent, deployment_name, database | database_id, replace_existing | Create 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.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
parent | string | The Branch where this Database will be created. Format: projects/{project_id}/branches/{branch_id} |
database_id | string | The 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_size | integer | Upper bound for items returned. |
page_token | string | Pagination token to go to the next page of Databases. Requests first page if absent. |
replace_existing | boolean | If true, update the database if it already exists instead of returning an error. |
SELECT examples
- list
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
- Manifest
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 }}'
;
# Description fields are for documentation purposes
- name: postgres_databases
props:
- name: parent
value: "{{ parent }}"
description: Required parameter for the postgres_databases resource.
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the postgres_databases resource.
- name: database
description: |
The desired specification of a Database.
value:
create_time: "{{ create_time }}"
database_id: "{{ database_id }}"
name: "{{ name }}"
parent: "{{ parent }}"
spec:
role: "{{ role }}"
postgres_database: "{{ postgres_database }}"
status:
database_id: "{{ database_id }}"
postgres_database: "{{ postgres_database }}"
role: "{{ role }}"
update_time: "{{ update_time }}"
- name: database_id
value: "{{ database_id }}"
description: The 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.
description: The 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.
- name: replace_existing
value: {{ replace_existing }}
description: If true, update the database if it already exists instead of returning an error.
description: If true, update the database if it already exists instead of returning an error.