databases
Creates, updates, deletes, gets or lists a databases resource.
Overview
| Name | databases |
| Type | Resource |
| Id | databricks_workspace.postgres.databases |
Fields
The following fields are returned by SELECT queries:
- list_databases
| Name | Datatype | Description |
|---|---|---|
name | string | The resource name of the database. Format: projects/{project_id}/branches/{branch_id}/databases/{database_id} |
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_databases | select | project_id, branch_id, deployment_name | page_size, page_token | List Databases. |
create_database | insert | project_id, branch_id, deployment_name, database | database_id | 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 |
|---|---|---|
branch_id | string | The unique identifier of the branch where this Database will be created. Format: projects/{project_id}/branches/{branch_id} |
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
project_id | string | The unique identifier of the Postgres project. Format: projects/{project_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. |
SELECT examples
- list_databases
List Databases.
SELECT
name,
create_time,
parent,
spec,
status,
update_time
FROM databricks_workspace.postgres.databases
WHERE project_id = '{{ project_id }}' -- required
AND branch_id = '{{ branch_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;
INSERT examples
- create_database
- Manifest
Create a Database.
INSERT INTO databricks_workspace.postgres.databases (
database,
project_id,
branch_id,
deployment_name,
database_id
)
SELECT
'{{ database }}' /* required */,
'{{ project_id }}',
'{{ branch_id }}',
'{{ deployment_name }}',
'{{ database_id }}'
;
# Description fields are for documentation purposes
- name: databases
props:
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the databases resource.
- name: branch_id
value: "{{ branch_id }}"
description: Required parameter for the databases resource.
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the databases resource.
- name: database
description: |
The desired specification of a Database.
value:
create_time: "{{ create_time }}"
name: "{{ name }}"
parent: "{{ parent }}"
spec:
postgres_database: "{{ postgres_database }}"
role: "{{ role }}"
status:
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.