Skip to main content

database_tables

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

Overview

Namedatabase_tables
TypeResource
Iddatabricks_workspace.database.database_tables

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringFull three-part (catalog, schema, table) name of the table.
database_instance_namestringName of the target database instance. This is required when creating database tables in standard catalogs. This is optional when creating database tables in registered catalogs. If this field is specified when creating database tables in registered catalogs, the database instance name MUST match that of the registered catalog (or the request will be rejected).
logical_database_namestringTarget Postgres database object (logical database) name for this table. When creating a table in a standard catalog, this field is required. In this scenario, specifying this field will allow targeting an arbitrary postgres database. Registration of database tables via /database/tables is currently only supported in standard catalogs.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, deployment_nameGet a Database Table.
createinsertdeployment_name, tableCreate a Database Table. Useful for registering pre-existing PG tables in UC. See
deletedeletename, deployment_nameDelete a Database Table.

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)
namestringstr

SELECT examples

Get a Database Table.

SELECT
name,
database_instance_name,
logical_database_name
FROM databricks_workspace.database.database_tables
WHERE name = '{{ name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Create a Database Table. Useful for registering pre-existing PG tables in UC. See

INSERT INTO databricks_workspace.database.database_tables (
table,
deployment_name
)
SELECT
'{{ table }}' /* required */,
'{{ deployment_name }}'
RETURNING
name,
database_instance_name,
logical_database_name
;

DELETE examples

Delete a Database Table.

DELETE FROM databricks_workspace.database.database_tables
WHERE name = '{{ name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;