Skip to main content

table_constraints

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

Overview

Nametable_constraints
TypeResource
Iddatabricks_workspace.unitycatalog.table_constraints

Fields

The following fields are returned by SELECT queries:

SELECT not supported for this resource, use SHOW METHODS to view available operations for the resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
createinsertdeployment_nameCreates a new table constraint.
deletedeletedeployment_nameDeletes a table constraint.

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)

INSERT examples

Creates a new table constraint.

INSERT INTO databricks_workspace.unitycatalog.table_constraints (
data__full_name_arg,
data__constraint,
deployment_name
)
SELECT
'{{ full_name_arg }}',
'{{ constraint }}',
'{{ deployment_name }}'
RETURNING
foreign_key_constraint,
named_table_constraint,
primary_key_constraint
;

DELETE examples

Deletes a table constraint.

DELETE FROM databricks_workspace.unitycatalog.table_constraints
WHERE deployment_name = '{{ deployment_name }}' --required;