TABLES
Applies to: Databricks SQL Databricks Runtime 10.4 LTS and above Unity Catalog only
INFORMATION_SCHEMA.TABLES
contains the object-level metadata for tables and views (relations) within the local catalog, or all catalogs visible to the workspace, if owned by the SYSTEM
catalog.
The rows returned are limited to the relations the user is privileged to interact with.
Definition
The TABLES
relation contains the following columns:
Name |
Data type |
Nullable |
Standard |
Description |
---|---|---|---|---|
|
|
No |
Yes |
Catalog that contains the relation. |
|
|
No |
Yes |
Schema that contains the relation. |
|
|
No |
Yes |
Name of the relation. |
|
|
No |
Yes |
See Table types. |
|
|
No |
Yes |
|
|
|
No |
Yes |
Always |
|
|
No |
No |
User or group (principal) currently owning the relation. |
|
|
Yes |
No |
An optional comment that describes the relation. |
|
|
No |
No |
Timestamp when the relation was created. |
|
|
No |
No |
Principal which created the relation. |
|
|
No |
No |
Timestamp when the relation definition was last altered in any way. |
|
|
No |
No |
Principal which last altered the relation. |
|
|
No |
No |
Format of the data source such as |
|
|
Yes |
No |
Discontinued. Always |
Constraints
The following constraints apply to the TABLES
relation:
Class |
Name |
Column List |
Description |
---|---|---|---|
Primary key |
|
|
Unique identifier for the relation. |
Foreign key |
|
|
References SCHEMATA. |
Table types
The TABLE_TYPE
column in the TABLES
relation can have the following values:
VIEW
: A virtual table that is defined by a query.FOREIGN
: A federated table.MANAGED
: A regular table for which the storage is managed by the catalog.STREAMING_TABLE
: A table that is used for streaming data.MATERIALIZED_VIEW
: A table that is a materialized view.EXTERNAL
: A table for which the storage is managed outside the catalog.MANAGED_SHALLOW_CLONE
: A table that is a shallow clone of a managed table.EXTERNAL_SHALLOW_CLONE
: A table that is a shallow clone of an external table.
Examples
> SELECT *
FROM information_schema.tables
WHERE table_schema = 'information_schema'
AND table_name = 'columns';
table_catalog table_schema table_name table_type is_insertable_into commit_action table_owner comment ...
------------- ------------------ ---------- ---------- ------------------ ------------- ----------- ----------------------------------------------------- ...
main information_schema columns VIEW NO PRESERVE System user Describes columns of tables and views in the catalog. ...