feat(snowflake): add Cortex Analyst operations to the Snowflake block
Merged
WA
1mo ago+1232+1232+0123456789012345678901234567890123456789-11-11-01234567890123456789
Summary
- Add Snowflake Cortex Analyst to the existing Snowflake block. It uses the same programmatic access token credential, with no new auth.
- Ask Cortex Analyst (
POST /api/v2/cortex/analyst/message):- Takes a question and exactly one semantic source: a semantic view, a staged semantic model file, inline YAML, or several sources for Cortex Analyst to choose between (
semantic_models). - Returns the interpretation, the SQL, the verified query used, suggestions (for ambiguous questions), warnings, question category and model names.
- Returns a
conversationoutput to pass back as history for multi-turn follow-ups. Analyst turns are echoed in the documented request shape (text plus SQL statement). - Optional Run Generated SQL chains the existing Execute SQL tool on the same credential. It runs in the semantic view's database and schema when those are fully qualified, and reuses the block's warehouse, role, max rows and timeout fields. Queries that are still running after 45 seconds come back as RUNNING, and Get Statement fetches the rows.
- Takes a question and exactly one semantic source: a semantic view, a staged semantic model file, inline YAML, or several sources for Cortex Analyst to choose between (
- Send Cortex Analyst Feedback (
POST /api/v2/cortex/analyst/feedback): request ID, required thumbs up/down, optional comment. - The question, history and inline semantic model YAML are declared as model input, since Cortex Analyst sends them to an LLM. View names and stage paths stay ordinary identifiers.
- Three Slack-orchestration templates (thread-scoped analyst, multi-view router, KPI digest) and an
ask-cortex-analystskill. - Extended the Snowflake param-coercion contract fixture with the new JSON params (count 54 → 58).
Type of Change
- New feature
Testing
- Checked every request field, header and response path against the Cortex Analyst REST reference, the multi-turn and access-control docs, and the PAT authentication docs. An independent audit pass also checked them against the docs.
- Ran the tools against the documented example payloads:
- request bodies for all four sources, the exactly-one rule, and multi-turn history
- the verified-query response and the suggestions response
- conversation round-trips
- the Run SQL chain, including returned and thrown failures
- feedback bodies, and the block's source inference and clearing
bun run lint,type-check,check-block-registry,check:audits,docs-manifest:check, canvas sentences 32/32.tools/snowflake+blocks/blocks.test.ts+tools/model-input-selectors.test.ts(99 passing). The updated coercion contract fails when the new coercion is removed.- Not run against a live Snowflake account.
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing (new tests pass the
test-auditauthoring gate) - No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)