Generate descriptions with Snowflake Cortex

You can use Snowsight and the power of Snowflake Cortex to automatically generate descriptions for a column, table, or view. Snowflake Cortex leverages Snowflake-hosted large language models (LLMs) to evaluate object metadata and, if desired, sample data to generate the description.

The generated description is saved in the COMMENT property of the column, table, or view. You can view the description anywhere the COMMENT property is displayed, which includes the following:

  • The Table Details and View Details tabs in Snowsight.

  • The Columns tab for the table or view in Snowsight.

  • The output of a DESCRIBE TABLE command.

  • The output of the Account Usage TABLES view.

A user with any privilege on the table or view, can view the description of the table, view, or column after the owner generates the description.

Accessing the feature

To see the feature that lets you generate descriptions with Snowflake Cortex, both of the following must be true:

Supported objects

You can generate descriptions for the following objects:

  • Table

  • View

  • Materialized view

  • Columns that are in tables and views.

Create and edit descriptions with Snowflake Cortex

The steps to generate and edit Snowflake Cortex Powered Descriptions for columns, tables, and views are in the following subsections.

Create descriptions for tables and views

To generate a description for a table or view, do the following:

  1. Sign in to Snowsight as a user with the required privileges.

  2. Navigate to the table or view for which you want to generate descriptions.

  3. If prompted, select a warehouse.

  4. On the Table Details tab or View Details tab, select Generate with Cortex.

  5. If you want to edit the description, select the pencil icon and edit the description.

  6. Select Save.

Create descriptions for all columns at once

Snowsight lets you generate descriptions for multiple columns at once, with an limit of 50 columns at a time. To generate descriptions for all columns in a table or view with a single action, do the following:

  1. Sign in to Snowsight as a user with the required privileges.

  2. Navigate to the table or view that contains the columns.

  3. If prompted, select a warehouse.

  4. Select the Columns tab.

  5. Select Generate Descriptions in the toolbar.

  6. If prompted, decide whether to use sample data.

  7. If you want to edit a description, select the pencil icon.

  8. Select the columns you want to save.

  9. Select Save.

  10. If your table or view has more than 50 columns and you want to generate descriptions for the remainder of the columns, repeat this process.

Create descriptions for a single column

To generate a description for a single column, do the following:

  1. Sign in to Snowsight as a user with the required privileges.

  2. Navigate to the table or view that contains the columns.

  3. If prompted, select a warehouse.

  4. Select the Columns tab.

  5. Find the column, hover over its row in the Description column, and then select Generate with Cortex.

  6. If prompted, decide whether to use sample data.

  7. If you want to edit the description, select the pencil icon.

  8. Select Save.

Overwrite existing descriptions

To replace a user-specified description with a generated description, do the following:

  1. Sign in to Snowsight as a user with the required privileges.

  2. Navigate to the table or view for which you want to edit descriptions.

  3. Select a warehouse if one is not already in use.

  4. Edit the descriptions for tables, views, and columns:

    • Tables and views: In the Table Details tab, select the pencil icon to edit the existing description, and select Generate with Cortex.

    • Columns: In the Columns tab, select the pencil icon for existing descriptions, and select Generate with Cortex.

  5. Select Save.

Access control requirements

Users need all of the following to generate descriptions with Snowflake Cortex:

For example, the account administrator can execute the following to let users with the role table_owner_role generate descriptions for their tables:

USE ROLE ACCOUNTADMIN;
GRANT USAGE ON WAREHOUSE ai_wh TO ROLE table_owner_role;
GRANT DATABASE ROLE SNOWFLAKE.CORTEX_USER TO ROLE table_owner_role;
Copy

Sample data inputs

When generating a description for a column, you can rely only on metadata, or you can choose to use sample data to improve the Snowflake Cortex Powered Description. Sample data refers to data within a particular column that is evaluated when you use Snowflake Cortex to generate descriptions. If you choose to use sample data, Snowflake uses a portion of the sample data to generate the description, which leads to more accurate descriptions. Sample data is not stored by Snowflake as usage data.

The decision to use sample data is specific to the individual user. The first time you generate a column description in a browser session, you will be prompted to decide whether to use sample data. The pop-up box defaults to yes and allows you to choose to disable sample data before proceeding. Your browser stores your response to this question for the duration of your Snowflake session and you won’t be asked again until your next session. You can also use your User Profile to set your preference for whether to use sample data.

Note

Sample data can cross regional boundaries if the region supports Snowflake Cortex. For more information, see Accessing the feature.

Cost considerations

Generating descriptions incurs the following costs:

  • Credits consumed by the warehouse in use.

  • Credits charged for the use of Snowflake Cortex with smaller LLMs like Mistral-7b and Llama 3.1-8b. These charges appear on a bill as AI-Services, which includes all uses of Snowflake Cortex.