Schema:

ORGANIZATION_USAGE

CLASS_INSTANCES view¶

Important

This view is only available in the organization account. For more information, see Premium views in the organization account.

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

Columns¶

Column Name

Data Type

Description

ORGANIZATION_NAME

VARCHAR

Name of the organization.

ACCOUNT_LOCATOR

VARCHAR

System-defined identifier for an account.

ACCOUNT_NAME

VARCHAR

User-defined identifier for an account.

ID

NUMBER

Internal/system-generated identifier for the instance.

NAME

TEXT

Name of the instance.

SCHEMA_ID

NUMBER

Internal/system-generated identifier for the schema of the instance.

SCHEMA_NAME

TEXT

Name of the schema the instance belongs to.

DATABASE_ID

NUMBER

Internal/system-generated identifier for the database of the instance.

DATABASE_NAME

TEXT

Name of the database the instance belongs to.

CLASS_ID

NUMBER

Internal/system-generated identifier for the class the instance is instantiated from.

CLASS_NAME

TEXT

Name of the class the instance is instantiated from.

CLASS_SCHEMA_ID

NUMBER

Internal/system-generated identifier for the schema of the class the instance is instantiated from.

CLASS_SCHEMA_NAME

TEXT

Name of the schema of the class the instance is instantiated from.

CLASS_DATABASE_ID

NUMBER

Internal/system-generated identifier for the database of the class the instance is instantiated from.

CLASS_DATABASE_NAME

TEXT

Name of the database of the class the instance is instantiated from.

OWNER_NAME

TEXT

Name of the role that owns the instance.

OWNER_ROLE_TYPE

TEXT

The internal/system-generated identifier of the role that owns the instance of the class.

CREATED

TIMESTAMP_LTZ

Date and time when the instance was created.

DELETED

TIMESTAMP_LTZ

Date and time when the instance was deleted.

COMMENT

TEXT

Comment for the instance.

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';
Copy

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;
Copy