CLASS_INSTANCES view | Snowflake Documentation

Schema:

ORGANIZATION_USAGE

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

Columns

Organization-level columns

Additional columns

Usage notes

  • Latency for the view may be up to 24 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 ACCOUNT_NAME, NAME, DATABASE_NAME, SCHEMA_NAME, CLASS_NAME
  FROM snowflake.organization_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.ORGANIZATION_USAGE.TABLES a
  JOIN SNOWFLAKE.ORGANIZATION_USAGE.CLASS_INSTANCES b
  ON a.INSTANCE_ID = b.ID
  WHERE b.DELETED IS NULL;