Skip to main content

vw_databases

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

Overview

Namevw_databases
TypeView
Iddatabricks_workspace.postgres.vw_databases

Fields

The following fields are returned by this view:

NameDatatypeDescription
namestringThe database identifier (last component of the resource path).
project_idstringThe project identifier that owns this database.
branch_idstringThe branch identifier that owns this database.
specobjectDatabase specification including postgres_database name and owner role.
postgres_databasestringThe name of the Postgres database.
rolestringThe identifier of the role that owns the database (last component of the resource path).

Required Parameters

The following parameters are required by this view:

NameDatatypeDescription
project_idstringThe project identifier to scope the query.
branch_idstringThe branch identifier to scope the query.
deployment_namestringThe 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

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 }}'