Skip to content
Get Started for Free

Metadata Views

Snowflake provides metadata views and table functions to query information about database objects, schemas, tables, columns, and query history. These views are available through two schemas:

  • INFORMATION_SCHEMA: A read-only schema present in every Snowflake database, scoped to that database’s objects.
  • ACCOUNT_USAGE: Available in the special SNOWFLAKE database, providing account-wide views that span all databases.

The Snowflake emulator supports querying metadata views, allowing you to inspect the structure of your local Snowflake objects using the same SQL syntax as the Snowflake service.

The INFORMATION_SCHEMA schema contains views that return metadata about objects within the current database. You can query it using <database_name>.INFORMATION_SCHEMA.<view_name> or simply INFORMATION_SCHEMA.<view_name> when a database context is active.

The TABLES view returns metadata about tables and views in the current database.

The following columns are returned:

ColumnData TypeDescription
TABLE_CATALOGTEXTName of the database containing the table
TABLE_SCHEMATEXTName of the schema containing the table
TABLE_NAMETEXTName of the table
TABLE_OWNERTEXTOwner of the table
TABLE_TYPETEXTType of object (BASE TABLE, VIEW, etc.)
IS_TRANSIENTTEXTWhether the table is transient
CLUSTERING_KEYTEXTClustering key expression
ROW_COUNTINTEGERApproximate number of rows
BYTESINTEGERApproximate size in bytes
RETENTION_TIMEINTEGERData retention period in days
SELF_REFERENCING_COLUMN_NAMETEXTName of the self-referencing column for typed tables
REFERENCE_GENERATIONTEXTHow the self-referencing column value is generated
USER_DEFINED_TYPE_CATALOGTEXTDatabase of the user-defined type for typed tables
USER_DEFINED_TYPE_SCHEMATEXTSchema of the user-defined type for typed tables
USER_DEFINED_TYPE_NAMETEXTName of the user-defined type for typed tables
IS_INSERTABLE_INTOTEXTWhether rows can be inserted into the table
IS_TYPEDTEXTWhether this is a typed table
COMMIT_ACTIONTEXTAction taken on commit for temporary tables
CREATEDTIMESTAMP_LTZTimestamp when the table was created
LAST_ALTEREDTIMESTAMP_LTZTimestamp when the table was last modified
LAST_DDLTIMESTAMP_LTZTimestamp of the last DDL operation
LAST_DDL_BYTEXTUser who last performed a DDL operation
AUTO_CLUSTERING_ONTEXTWhether automatic clustering is enabled
COMMENTTEXTComment on the table
IS_TEMPORARYTEXTWhether the table is temporary
IS_ICEBERGTEXTWhether the table is an Iceberg table
IS_DYNAMICTEXTWhether the table is a Dynamic table
IS_IMMUTABLETEXTWhether the table is immutable
IS_HYBRIDTEXTWhether the table is a Hybrid table

The COLUMNS view returns metadata about the columns of tables and views in the current database.

The following columns are returned:

ColumnData TypeDescription
TABLE_CATALOGTEXTName of the database
TABLE_SCHEMATEXTName of the schema
TABLE_NAMETEXTName of the table
COLUMN_NAMETEXTName of the column
ORDINAL_POSITIONINTEGERPosition of the column within the table
COLUMN_DEFAULTTEXTDefault value expression of the column
IS_NULLABLETEXTWhether the column allows NULL values
DATA_TYPETEXTSnowflake data type of the column
CHARACTER_MAXIMUM_LENGTHINTEGERMaximum length for character data types
CHARACTER_OCTET_LENGTHINTEGERMaximum octet length for character data types
NUMERIC_PRECISIONINTEGERPrecision for numeric data types
NUMERIC_PRECISION_RADIXINTEGERRadix for numeric precision
NUMERIC_SCALEINTEGERScale for numeric data types
DATETIME_PRECISIONINTEGERFractional seconds precision for datetime types
INTERVAL_TYPETEXTInterval type qualifier
INTERVAL_PRECISIONINTEGERInterval precision
CHARACTER_SET_CATALOGTEXTNot applicable in Snowflake (always NULL)
CHARACTER_SET_SCHEMATEXTNot applicable in Snowflake (always NULL)
CHARACTER_SET_NAMETEXTNot applicable in Snowflake (always NULL)
COLLATION_CATALOGTEXTNot applicable in Snowflake (always NULL)
COLLATION_SCHEMATEXTNot applicable in Snowflake (always NULL)
COLLATION_NAMETEXTNot applicable in Snowflake (always NULL)
DOMAIN_CATALOGTEXTNot applicable in Snowflake (always NULL)
DOMAIN_SCHEMATEXTNot applicable in Snowflake (always NULL)
DOMAIN_NAMETEXTNot applicable in Snowflake (always NULL)
UDT_CATALOGTEXTNot applicable in Snowflake (always NULL)
UDT_SCHEMATEXTNot applicable in Snowflake (always NULL)
UDT_NAMETEXTNot applicable in Snowflake (always NULL)
SCOPE_CATALOGTEXTNot applicable in Snowflake (always NULL)
SCOPE_SCHEMATEXTNot applicable in Snowflake (always NULL)
SCOPE_NAMETEXTNot applicable in Snowflake (always NULL)
MAXIMUM_CARDINALITYINTEGERNot applicable in Snowflake (always NULL)
DTD_IDENTIFIERTEXTNot applicable in Snowflake (always NULL)
IS_SELF_REFERENCINGTEXTWhether the column is self-referencing
IS_IDENTITYTEXTWhether the column is an identity column
IDENTITY_GENERATIONTEXTHow identity values are generated
IDENTITY_STARTTEXTStart value for identity columns
IDENTITY_INCREMENTTEXTIncrement for identity columns
IDENTITY_MAXIMUMTEXTMaximum value for identity columns
IDENTITY_MINIMUMTEXTMinimum value for identity columns
IDENTITY_CYCLETEXTWhether the identity column cycles
IDENTITY_ORDEREDTEXTWhether the identity column is ordered
SCHEMA_EVOLUTION_RECORDTEXTSchema evolution record for the column
COMMENTTEXTComment on the column

The SCHEMATA view returns metadata about schemas in the current database.

The following columns are returned:

ColumnData TypeDescription
CATALOG_NAMETEXTName of the database
SCHEMA_NAMETEXTName of the schema
SCHEMA_OWNERTEXTOwner of the schema (NULL for INFORMATION_SCHEMA)
IS_TRANSIENTTEXTWhether the schema is transient
IS_MANAGED_ACCESSTEXTWhether managed access is enabled
RETENTION_TIMENUMBERData retention period in days
DEFAULT_CHARACTER_SET_CATALOGTEXTNot applicable in Snowflake (always NULL)
DEFAULT_CHARACTER_SET_SCHEMATEXTNot applicable in Snowflake (always NULL)
DEFAULT_CHARACTER_SET_NAMETEXTNot applicable in Snowflake (always NULL)
SQL_PATHTEXTNot applicable in Snowflake (always NULL)
CREATEDTIMESTAMP_LTZTimestamp when the schema was created
LAST_ALTEREDTIMESTAMP_LTZTimestamp when the schema was last modified
COMMENTTEXTComment on the schema
REPLICABLE_WITH_FAILOVER_GROUPSTEXTWhether the schema can be replicated with failover groups
OWNER_ROLE_TYPETEXTType of role that owns the schema

The VIEWS view returns metadata about views in the current database.

The following columns are returned:

ColumnData TypeDescription
TABLE_CATALOGTEXTName of the database
TABLE_SCHEMATEXTName of the schema
TABLE_NAMETEXTName of the view
TABLE_OWNERTEXTOwner of the view
VIEW_DEFINITIONTEXTFull SQL definition of the view, prefixed with CREATE VIEW <schema>.<name> AS
CHECK_OPTIONTEXTCheck option (always NONE)
IS_UPDATABLETEXTWhether the view is updatable
INSERTABLE_INTOTEXTWhether rows can be inserted into the view
IS_SECURETEXTWhether the view is a secure view
CREATEDTIMESTAMP_LTZTimestamp when the view was created
LAST_ALTEREDTIMESTAMP_LTZTimestamp when the view was last modified
LAST_DDLTIMESTAMP_LTZTimestamp of the last DDL operation
LAST_DDL_BYTEXTUser who last performed a DDL operation
COMMENTTEXTComment on the view

The DATABASES view returns metadata about databases accessible in the account.

The following columns are returned:

ColumnData TypeDescription
DATABASE_NAMETEXTName of the database
DATABASE_OWNERTEXTOwner of the database
IS_TRANSIENTTEXTWhether the database is transient
COMMENTTEXTComment on the database
CREATEDTIMESTAMP_LTZTimestamp when the database was created
LAST_ALTEREDTIMESTAMP_LTZTimestamp when the database was last modified
RETENTION_TIMENUMBERData retention period in days
TYPETEXTDatabase type (e.g., STANDARD)
REPLICABLE_WITH_FAILOVER_GROUPSTEXTWhether the database can be replicated with failover groups
OWNER_ROLE_TYPETEXTType of role that owns the database

In addition to views, INFORMATION_SCHEMA provides table functions that return tabular results. These are invoked using the TABLE() syntax.

The QUERY_HISTORY table function returns the recent query execution history for the current account.

The function accepts the following parameters:

ParameterTypeDefaultDescription
RESULT_LIMITNUMBER100Maximum number of rows to return (range: 1–10000)
END_TIME_RANGE_STARTTIMESTAMP_LTZNULLReturn queries whose end time is at or after this value
END_TIME_RANGE_ENDTIMESTAMP_LTZNULLReturn queries whose end time is before this value
INCLUDE_CLIENT_GENERATED_STATEMENTBOOLEANNULLWhether to include client-generated statements

The QUERY_HISTORY_BY_USER table function returns the recent query execution history for a specific user. It returns the same columns as QUERY_HISTORY.

The function accepts the following parameters:

ParameterTypeDefaultDescription
USER_NAMEVARCHARNULLUser whose history to return; defaults to the current session user
END_TIME_RANGE_STARTTIMESTAMP_LTZNULLReturn queries whose end time is at or after this value
END_TIME_RANGE_ENDTIMESTAMP_LTZNULLReturn queries whose end time is before this value
RESULT_LIMITNUMBER100Maximum number of rows to return (range: 1–10000)
INCLUDE_CLIENT_GENERATED_STATEMENTBOOLEANNULLWhether to include client-generated statements

The TAG_REFERENCES table function returns all tag assignments for a specific object within the current database.

The function accepts the following positional parameters:

ParameterTypeDescription
OBJECT_NAMEVARCHARName of the object to look up tag assignments for
OBJECT_DOMAINVARCHARDomain of the object (e.g., table, column, schema, database)

The ACCOUNT_USAGE schema is available in the special SNOWFLAKE database and provides views with account-wide visibility across all databases. Query it using SNOWFLAKE.ACCOUNT_USAGE.<view_name>.

The ACCOUNT_USAGE.TAG_REFERENCES view returns all tag-to-object associations across the entire account. Unlike the INFORMATION_SCHEMA.TAG_REFERENCES() table function, this view returns every tag assignment without requiring you to specify a particular object.

The following columns are returned:

ColumnData TypeDescription
TAG_DATABASETEXTName of the database containing the tag
TAG_SCHEMATEXTName of the schema containing the tag
TAG_IDNUMBERInternal identifier of the tag
TAG_NAMETEXTName of the tag
TAG_VALUETEXTValue assigned to the tag
OBJECT_DATABASETEXTDatabase of the tagged object (NULL for DATABASE, ROLE, and WAREHOUSE domains)
OBJECT_SCHEMATEXTSchema of the tagged object (NULL for DATABASE, SCHEMA, ROLE, and WAREHOUSE domains)
OBJECT_IDNUMBERInternal identifier of the tagged object
OBJECT_NAMETEXTName of the tagged object
OBJECT_DELETEDTIMESTAMP_LTZTimestamp when the tagged object was deleted, if applicable
DOMAINTEXTType of the tagged object (TABLE, COLUMN, SCHEMA, DATABASE, ROLE, WAREHOUSE, etc.)
COLUMN_IDTEXTInternal identifier of the tagged column
COLUMN_NAMETEXTName of the tagged column when DOMAIN is COLUMN; otherwise NULL
APPLY_METHODTEXTMethod by which the tag was applied

For more information on Snowflake metadata views, refer to the Snowflake INFORMATION_SCHEMA documentation and the Snowflake ACCOUNT_USAGE documentation.

Was this page helpful?