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:
You must have the required access control privileges.
Your region must support the LLM used by Snowflake Cortex to generate the descriptions. If you have the required privileges, but do not see this feature, check the availability of the COMPLETE function. If the COMPLETE function is not supported in your region, you need to enable cross-region inference to use the feature.
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:
Sign in to Snowsight as a user with the required privileges.
Navigate to the table or view for which you want to generate descriptions.
If prompted, select a warehouse.
On the Table Details tab or View Details tab, select Generate with Cortex.
If you want to edit the description, select the pencil icon and edit the description.
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:
Sign in to Snowsight as a user with the required privileges.
Navigate to the table or view that contains the columns.
If prompted, select a warehouse.
Select the Columns tab.
Select Generate Descriptions in the toolbar.
If prompted, decide whether to use sample data.
If you want to edit a description, select the pencil icon.
Select the columns you want to save.
Select Save.
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:
Sign in to Snowsight as a user with the required privileges.
Navigate to the table or view that contains the columns.
If prompted, select a warehouse.
Select the Columns tab.
Find the column, hover over its row in the Description column, and then select Generate with Cortex.
If prompted, decide whether to use sample data.
If you want to edit the description, select the pencil icon.
Select Save.
Overwrite existing descriptions¶
To replace a user-specified description with a generated description, do the following:
Sign in to Snowsight as a user with the required privileges.
Navigate to the table or view for which you want to edit descriptions.
Select a warehouse if one is not already in use.
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.
Select Save.
Access control requirements¶
Users need all of the following to generate descriptions with Snowflake Cortex:
The OWNERSHIP privilege on the table or view.
The USAGE privilege on a warehouse.
The SNOWFLAKE.CORTEX_USER database role to use 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;
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.
Legal Notices¶
The data classification of inputs and outputs are as set forth in the following table.
Input data classification |
Output data classification |
Designation |
---|---|---|
Usage Data |
Usage Data |
Covered AI Features [1] |
For additional information, refer to Snowflake AI and ML.