How Snowflake Cortex Runs Generative AI Directly Inside SQL Queries
Snowflake Cortex allows developers to run generative AI models as native SQL functions, executing once per row within standard SELECT statements alongside WHERE, JOIN, and GROUP BY clauses. Key functions include AI_COMPLETE for general text generation, AI_CLASSIFY for categorizing free text into custom labels, AI_FILTER for natural-language row filtering, and AI_AGG for summarizing entire columns without context-window chunking. Access requires granting the SNOWFLAKE.CORTEX_USER database role to a purpose-built role via ACCOUNTADMIN, and AI workloads should run on a dedicated warehouse to keep credit consumption visible and controllable. Costs accrue on two dimensions: warehouse credits for query execution and token-based billing for each model call, making row-level testing with LIMIT essential before scaling to large tables. Developers should note that older syntax such as SNOWFLAKE.CORTEX.COMPLETE and CLASSIFY_TEXT has been superseded by updated equivalents like AI_COMPLETE and AI_CLASSIFY in current Snowflake releases.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in