CONSTRAINT_TABLE_USAGE
Applies to: Databricks SQL
Databricks Runtime 11.3 LTS and above
Unity Catalog only
This feature is in Public Preview.
INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE lists all constraints that reference a table as either a foreign or primary key within the catalog.
The rows returned are limited to the tables the user is privileged to interact with.
Definition
The CONSTRAINT_TABLE_USAGE
relation contains the following columns:
Name | Data type | Nullable | Standard | Description |
---|---|---|---|---|
|
| No | Yes | Catalog containing the relation. |
|
| No | Yes | Schema containing the relation. |
|
| No | Yes | Name of the relation. |
|
| No | Yes | Catalog containing the constraint. |
|
| No | Yes | Schema containing the constraint. |
|
| No | Yes | Name of the constraint. |
Constraints
The following constraints apply to the CONSTRAINT_TABLE_USAGE
relation:
Class | Name | Column List | Description |
---|---|---|---|
Primary key |
|
| Uniquely identifies the relation. |
Foreign key |
|
| References TABLES |
Foreign key |
|
| References TABLE_CONSTRAINTS. |
Examples
> SELECT constraint_name
FROM information_schema.constraint_table_usage
WHERE table_schema = 'information_schema'
AND table_name = 'tables'