Skip to main content

TABLES

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 10.4 LTS and above check marked yes 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:

NameData typeNullableStandardDescription
TABLE_CATALOGSTRINGNoYesCatalog that contains the relation.
TABLE_SCHEMASTRINGNoYesSchema that contains the relation.
TABLE_NAMESTRINGNoYesName of the relation.
TABLE_TYPESTRINGNoYesSee Table types.
IS_INSERTABLE_INTOSTRINGNoYes'YES' if the relation can be inserted into, 'NO' otherwise.
COMMIT_ACTIONSTRINGNoYesAlways 'PRESERVE'. Reserved for future use.
TABLE_OWNERSTRINGNoNoUser or group (principal) currently owning the relation.
COMMENTSTRINGYesNoAn optional comment that describes the relation.
CREATEDTIMESTAMPNoNoTimestamp when the relation was created.
CREATED_BYSTRINGNoNoPrincipal which created the relation.
LAST_ALTEREDTIMESTAMPNoNoTimestamp when the relation definition was last altered in any way.
LAST_ALTERED_BYSTRINGNoNoPrincipal which last altered the relation.
DATA_SOURCE_FORMATSTRINGNoNoFormat of the data source such as PARQUET, or CSV.
STORAGE_PATHSTRINGYesNoStorage root URL for managed and external tables.
STORAGE_SUB_DIRECTORYSTRINGYesNoDiscontinued. Always NULL.

Constraints

The following constraints apply to the TABLES relation:

ClassNameColumn ListDescription
Primary keyTABLES_PKTABLE_CATALOG, TABLE_SCHEMA, TABLE_NAMEUnique identifier for the relation.
Foreign keyTABLES_SCHEMATA_FKTABLE_CATALOG, TABLE_SCHEMAReferences 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

SQL
> 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. ...