Schema:

ACCOUNT_USAGE

CLASS_INSTANCES view

This Account Usage view displays a row for each instance of a class defined in the account.

Columns

Column NameData TypeDescription
IDNUMBERInternal/system-generated identifier for the instance.
NAMEVARCHARName of the instance.
SCHEMA_IDNUMBERInternal/system-generated identifier for the schema of the instance.
SCHEMA_NAMEVARCHARName of the schema the instance belongs to.
DATABASE_IDNUMBERInternal/system-generated identifier for the database of the instance.
DATABASE_NAMEVARCHARName of the database the instance belongs to.
CLASS_IDNUMBERInternal/system-generated identifier for the class the instance is instantiated from.
CLASS_NAMEVARCHARName of the class the instance is instantiated from.
CLASS_SCHEMA_IDNUMBERInternal/system-generated identifier for the schema of the class the instance is instantiated from.
CLASS_SCHEMA_NAMEVARCHARName of the schema of the class the instance is instantiated from.
CLASS_DATABASE_IDNUMBERInternal/system-generated identifier for the database of the class the instance is instantiated from.
CLASS_DATABASE_NAMEVARCHARName of the database of the class the instance is instantiated from.
OWNER_NAMEVARCHARName of the role that owns the instance.
OWNER_ROLE_TYPEVARCHARThe internal/system-generated identifier of the role that owns the instance of the class.
CREATEDTIMESTAMP_LTZDate and time when the instance was created.
DELETEDTIMESTAMP_LTZDate and time when the instance was deleted.
COMMENTVARCHARComment for the instance.

Usage notes

  • Latency for the view may be up to 180 minutes (3 hours).
  • The view only displays the instances for which the current role for the session has been granted access privileges.

Examples

The following example finds all instances of the ANOMALY_DETECTION class:

SELECT NAME, DATABASE_NAME, SCHEMA_NAME, CLASS_NAME
  FROM SNOWFLAKE.ACCOUNT_USAGE.CLASS_INSTANCES
  WHERE CLASS_NAME = 'ANOMALY_DETECTION';

The following example joins this view with TABLES view on the INSTANCE_ID column to find the tables that belong to each instance:

SELECT a.TABLE_NAME,
       b.NAME AS instance_name,
       b.CLASS_NAME
  FROM SNOWFLAKE.ACCOUNT_USAGE.TABLES a
  JOIN SNOWFLAKE.ACCOUNT_USAGE.CLASS_INSTANCES b
  ON a.INSTANCE_ID = b.ID
  WHERE b.DELETED IS NULL;