table_constraints
Creates, updates, deletes, gets or lists a table_constraints resource.
Overview
| Name | table_constraints |
| Type | Resource |
| Id | databricks_workspace.catalog.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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
create | insert | deployment_name, full_name_arg, constraint | Creates a new table constraint. | |
delete | delete | full_name, constraint_name, cascade, deployment_name | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
cascade | boolean | If true, try deleting all child constraints of the current constraint. If false, reject this operation if the current constraint has any child constraints. |
constraint_name | string | The name of the constraint to delete. |
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
full_name | string | Full name of the table referenced by the constraint. |
INSERT examples
- create
- Manifest
Creates a new table constraint.
INSERT INTO databricks_workspace.catalog.table_constraints (
full_name_arg,
constraint,
deployment_name
)
SELECT
'{{ full_name_arg }}' /* required */,
'{{ constraint }}' /* required */,
'{{ deployment_name }}'
RETURNING
foreign_key_constraint,
named_table_constraint,
primary_key_constraint
;
# Description fields are for documentation purposes
- name: table_constraints
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the table_constraints resource.
- name: full_name_arg
value: "{{ full_name_arg }}"
description: |
The full name of the table referenced by the constraint.
- name: constraint
description: |
:returns: :class:`TableConstraint`
value:
foreign_key_constraint:
name: "{{ name }}"
child_columns:
- "{{ child_columns }}"
parent_table: "{{ parent_table }}"
parent_columns:
- "{{ parent_columns }}"
rely: {{ rely }}
named_table_constraint:
name: "{{ name }}"
primary_key_constraint:
name: "{{ name }}"
child_columns:
- "{{ child_columns }}"
rely: {{ rely }}
timeseries_columns:
- "{{ timeseries_columns }}"
DELETE examples
- delete
Deletes a table constraint.
DELETE FROM databricks_workspace.catalog.table_constraints
WHERE full_name = '{{ full_name }}' --required
AND constraint_name = '{{ constraint_name }}' --required
AND cascade = '{{ cascade }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;