A runnable Cortex AISQL lab exposes the production checks demos skip
7Rivers’ worksheet covers 12 AI functions, but the useful lesson is what teams must verify around privileges, stages, cost and failure handling.
A Snowflake partner has published the kind of Cortex AISQL tutorial that is unusually easy to reproduce: three CSVs, a synthetic contract PDF and one worksheet covering a dozen AI functions. The 7Rivers developer guide links the package directly, including the complete runnable SQL worksheet, a support-ticket CSV and the synthetic vendor contract. The files make the lab useful for learning. They also make its operational boundaries easier to inspect.
The downloadable worksheet includes AI_CLASSIFY, AI_SENTIMENT, AI_FILTER, AI_AGG, AI_SUMMARIZE_AGG, AI_TRANSLATE, AI_REDACT, AI_EXTRACT, AI_PARSE_DOCUMENT, AI_COMPLETE, AI_EMBED and AI_SIMILARITY. Snowflake’s AISQL documentation describes the managed SQL functions for text, image and document analytics.
For teams turning the worksheet into a pilot, four checks matter more than copying the SELECT statements.
1. Treat access as a deployment dependency
The worksheet requires the account-level USE AI FUNCTIONS privilege and grants the SNOWFLAKE.CORTEX_USER database role to the role running the examples. Snowflake documents the same access requirements on its AISQL overview. A pilot run as ACCOUNTADMIN proves syntax, not the production access model.
2. Test the real stage configuration
The document examples depend on Snowflake FILE objects. The lab creates an internal stage with its directory table enabled and leaves encryption at the server-side default. Snowflake’s AI_CLASSIFY reference lists unsupported inputs including internal stages using SNOWFLAKE_FULL, user stages and table stages. Test with the same stage type, encryption and naming conventions planned for production—not only the tutorial’s clean stage.
3. Budget by rows, pages and prompts
Snowflake says AISQL is optimized for throughput and recommends batch processing rather than interactive, latency-sensitive use. Its AISQL documentation exposes AI_COUNT_TOKENS for checking prompt size before a call. Snowflake’s AI_EXTRACT documentation says extraction cost depends on document pages, input-prompt tokens and output tokens.
4. Design for partial failure and review
Several AI functions return structured objects, and errors can become nulls without failing an entire multirow query. Snowflake documents optional error-detail returns for functions including AI_CLASSIFY and AI_PARSE_DOCUMENT. AI_EXTRACT can also return per-field confidence scores, which Snowflake positions for thresholds, fallbacks and human review.
That makes the right graduation test clear: do not ask only whether the sample worksheet runs. Ask whether the production pipeline records function status, preserves errors, measures token and page consumption, and routes uncertain output for review. The downloadable lab is a strong starting point precisely because it is small enough to instrument before anyone scales it.
sources
- 7Rivers — Beyond the Dashboard, Part Two: A Developer’s Guide to Snowflake Cortex AISQL7riversinc.com
- 7Rivers — Cortex AISQL Developer Guide runnable SQL worksheetgo.7riversinc.com
- 7Rivers — Cortex AISQL lab support-ticket sample datago.7riversinc.com
- 7Rivers — Cortex AISQL lab synthetic vendor agreementgo.7riversinc.com
- Snowflake docs — Cortex AI Functionsdocs.snowflake.com
- Snowflake docs — AI_CLASSIFYdocs.snowflake.com
- Snowflake docs — AI_EXTRACTdocs.snowflake.com
- Snowflake docs — AI_PARSE_DOCUMENTdocs.snowflake.com
comments · 0