vw_databases
Creates, updates, deletes, gets or lists a vw_databases resource.
Overview
| Name | vw_databases |
| Type | View |
| Id | databricks_workspace.postgres.vw_databases |
Fields
The following fields are returned by this view:
| Name | Datatype | Description |
|---|---|---|
name | string | The database identifier (last component of the resource path). |
project_id | string | The project identifier that owns this database. |
branch_id | string | The branch identifier that owns this database. |
spec | object | Database specification including postgres_database name and owner role. |
postgres_database | string | The name of the Postgres database. |
role | string | The identifier of the role that owns the database (last component of the resource path). |
Required Parameters
The following parameters are required by this view:
| Name | Datatype | Description |
|---|---|---|
project_id | string | The project identifier to scope the query. |
branch_id | string | The branch identifier to scope the query. |
deployment_name | string | The Databricks workspace deployment name. |
SELECT Examples
SELECT
name,
project_id,
branch_id,
spec,
postgres_database,
role
FROM databricks_workspace.postgres.vw_databases
WHERE project_id = '{{ project_id }}'
AND branch_id = '{{ branch_id }}'
AND deployment_name = '{{ deployment_name }}';
SQL Definition
- Sqlite3
- Postgres
SELECT
SPLIT_PART(name, '/', -1) AS name,
project_id,
branch_id,
spec,
JSON_EXTRACT(status, '$.postgres_database') AS postgres_database,
SPLIT_PART(JSON_EXTRACT(status, '$.role'), '/', -1) AS role
FROM databricks_workspace.postgres.databases
WHERE deployment_name = '{{ deployment_name }}'
AND project_id = '{{ project_id }}'
AND branch_id = '{{ branch_id }}'
SELECT
SPLIT_PART(name, '/', -1) AS name,
project_id,
branch_id,
spec,
(status::jsonb)->>'postgres_database' AS postgres_database,
SPLIT_PART((status::jsonb)->>'role', '/', -1) AS role
FROM databricks_workspace.postgres.databases
WHERE deployment_name = '{{ deployment_name }}'
AND project_id = '{{ project_id }}'
AND branch_id = '{{ branch_id }}'