QuestionQ4

VerifiedOfficial exam objectives/topics

A user executed a one-time AI_SUMMARIZE_AGG query on a large log table using a Cortex AI model. Although it ran on a size Small virtual warehouse, the query consumed more than 1,000 credits.

A Data Engineer must implement a Snowflake-native automated alert that fires whenever a single Cortex AI SQL query uses 300 credits, allowing the query text and selected model to be reviewed.

How should these requirements be fulfilled?

Explanation

Cortex AI SQL usage history supplies per-query usage together with model metadata and a query ID. That query ID can be joined to SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY, which contains the SQL text, while a scheduled task can send a notification when the per-query threshold is exceeded. Warehouse resource monitors and daily metering are aggregate controls, so they cannot identify the individual Cortex query and model. In the current CORTEX_AISQL_USAGE_HISTORY view, the billed-credit column is named TOKEN_CREDITS; implementations should use that current column name. CORTEX_AISQL_USAGE_HISTORY view, QUERY_HISTORY view

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!