Snowflake Copilot Advanced Features
Snowflake Copilot uses large language models to enable natural language data analysis, automated insights, and intelligent query generation.
Architecture Overview
<svg width="800" height="450" viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="copilotGrad" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:#FF6B6B;stop-opacity:1" />
<stop offset="100%" style="stop-color:#FF8E8E;stop-opacity:1" />
</linearGradient>
<linearGradient id="aiGrad" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:#4ECDC4;stop-opacity:1" />
<stop offset="100%" style="stop-color:#7EDDD6;stop-opacity:1" />
</linearGradient>
</defs>
<text x="400" y="30" text-anchor="middle" font-size="18" font-weight="bold" fill="#333">Snowflake Copilot Architecture</text>
<rect x="30" y="60" width="180" height="100" rx="10" fill="#6C5CE7" opacity="0.9"/>
<text x="120" y="85" text-anchor="middle" font-size="12" fill="white" font-weight="bold">User Input</text>
<text x="120" y="110" text-anchor="middle" font-size="10" fill="white">Natural Language</text>
<text x="120" y="125" text-anchor="middle" font-size="10" fill="white">Questions</text>
<text x="120" y="140" text-anchor="middle" font-size="10" fill="white">Analysis Requests</text>
<path d="M210 110 L250 110" stroke="#333" stroke-width="2" fill="none" marker-end="url(#arrowCopilot)"/>
<rect x="250" y="60" width="300" height="100" rx="10" fill="url(#copilotGrad)" opacity="0.9"/>
<text x="400" y="85" text-anchor="middle" font-size="14" fill="white" font-weight="bold">Copilot Engine</text>
<rect x="270" y="100" width="80" height="45" rx="5" fill="white" opacity="0.9"/>
<text x="310" y="127" text-anchor="middle" font-size="9" fill="#333">NLP</text>
<rect x="360" y="100" width="80" height="45" rx="5" fill="white" opacity="0.9"/>
<text x="400" y="127" text-anchor="middle" font-size="9" fill="#333">Schema</text>
<rect x="450" y="100" width="80" height="45" rx="5" fill="white" opacity="0.9"/>
<text x="490" y="127" text-anchor="middle" font-size="9" fill="#333">Context</text>
<path d="M400 160 L400 190" stroke="#333" stroke-width="2" fill="none" marker-end="url(#arrowCopilot)"/>
<rect x="250" y="190" width="300" height="100" rx="10" fill="url(#aiGrad)" opacity="0.9"/>
<text x="400" y="215" text-anchor="middle" font-size="14" fill="white" font-weight="bold">AI Processing</text>
<rect x="270" y="230" width="80" height="45" rx="5" fill="white" opacity="0.9"/>
<text x="310" y="257" text-anchor="middle" font-size="9" fill="#333">LLM</text>
<rect x="360" y="230" width="80" height="45" rx="5" fill="white" opacity="0.9"/>
<text x="400" y="257" text-anchor="middle" font-size="9" fill="#333">SQL Gen</text>
<rect x="450" y="230" width="80" height="45" rx="5" fill="white" opacity="0.9"/>
<text x="490" y="257" text-anchor="middle" font-size="9" fill="#333">Insights</text>
<path d="M550 110 L590 110" stroke="#333" stroke-width="2" fill="none" marker-end="url(#arrowCopilot)"/>
<rect x="590" y="60" width="180" height="100" rx="10" fill="#3498DB" opacity="0.9"/>
<text x="680" y="85" text-anchor="middle" font-size="12" fill="white" font-weight="bold">Output</text>
<text x="680" y="110" text-anchor="middle" font-size="10" fill="white">SQL Queries</text>
<text x="680" y="125" text-anchor="middle" font-size="10" fill="white">Visualizations</text>
<text x="680" y="140" text-anchor="middle" font-size="10" fill="white">Insights</text>
<rect x="30" y="310" width="740" height="120" rx="10" fill="#F39C12" opacity="0.85"/>
<text x="400" y="335" text-anchor="middle" font-size="14" fill="white" font-weight="bold">Key Features</text>
<rect x="50" y="355" width="170" height="60" rx="8" fill="white"/>
<text x="135" y="375" text-anchor="middle" font-size="10" fill="#333" font-weight="bold">Natural Language</text>
<text x="135" y="395" text-anchor="middle" font-size="9" fill="#666">Ask questions in plain English</text>
<rect x="240" y="355" width="170" height="60" rx="8" fill="white"/>
<text x="325" y="375" text-anchor="middle" font-size="10" fill="#333" font-weight="bold">SQL Generation</text>
<text x="325" y="395" text-anchor="middle" font-size="9" fill="#666">Automatic query creation</text>
<rect x="430" y="355" width="170" height="60" rx="8" fill="white"/>
<text x="515" y="375" text-anchor="middle" font-size="10" fill="#333" font-weight="bold">Smart Suggestions</text>
<text x="515" y="395" text-anchor="middle" font-size="9" fill="#666">Follow-up recommendations</text>
<rect x="620" y="355" width="140" height="60" rx="8" fill="white"/>
<text x="690" y="375" text-anchor="middle" font-size="10" fill="#333" font-weight="bold">Schema Aware</text>
<text x="690" y="395" text-anchor="middle" font-size="9" fill="#666">Understands your data</text>
<defs>
<marker id="arrowCopilot" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
<path d="M0,0 L0,6 L9,3 z" fill="#333"/>
</marker>
</defs>
</svg>
Natural Language Queries
Asking Questions
-- Via Snowsight UI or API
-- User: "Show me the top 10 customers by revenue in Q4 2024"
-- Copilot generates:
SELECT
c.customer_name,
SUM(o.order_amount) as total_revenue
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id
WHERE o.order_date >= '2024-10-01'
AND o.order_date <= '2024-12-31'
GROUP BY c.customer_name
ORDER BY total_revenue DESC
LIMIT 10;
Complex Analysis
-- User: "What's the month-over-month growth rate for each product category?"
-- Copilot generates:
WITH monthly_sales AS (
SELECT
p.category,
DATE_TRUNC('month', o.order_date) as month,
SUM(o.quantity * o.unit_price) as revenue
FROM products p
JOIN order_items o ON p.product_id = o.product_id
GROUP BY 1, 2
)
SELECT
category,
month,
revenue,
LAG(revenue) OVER (PARTITION BY category ORDER BY month) as prev_month,
ROUND(((revenue - prev_month) / prev_month) * 100, 2) as growth_pct
FROM monthly_sales
ORDER BY category, month;
Smart Suggestions
Follow-up Recommendations
-- After running a query, Copilot suggests:
-- "Would you like to:"
-- 1. "Add a trend line to visualize the pattern?"
-- 2. "Compare this with last year's data?"
-- 3. "Break this down by region?"
-- 4. "Export this as a CSV?"
-- Example follow-up query
SELECT
category,
month,
revenue,
CASE
WHEN revenue > LAG(revenue) OVER (PARTITION BY category ORDER BY month)
THEN 'Up'
WHEN revenue < LAG(revenue) OVER (PARTITION BY category ORDER BY month)
THEN 'Down'
ELSE 'Flat'
END as trend
FROM monthly_sales
WHERE EXTRACT(YEAR FROM month) = 2024;
Contextual Understanding
Schema Awareness
-- Copilot understands your schema
-- User: "Show me customer churn analysis"
-- Copilot identifies relevant tables:
SELECT
c.customer_id,
c.customer_name,
MAX(o.order_date) as last_order_date,
DATEDIFF(day, MAX(o.order_date), CURRENT_DATE()) as days_since_last_order,
CASE
WHEN DATEDIFF(day, MAX(o.order_date), CURRENT_DATE()) > 90
THEN 'At Risk'
WHEN DATEDIFF(day, MAX(o.order_date), CURRENT_DATE()) > 180
THEN 'Churned'
ELSE 'Active'
END as status
FROM customers c
LEFT JOIN orders o ON c.customer_id = o.customer_id
GROUP BY c.customer_id, c.customer_name;
Business Context
-- Copilot learns business terminology
-- User: "Show me gold customers who are at risk"
-- Copilot understands:
-- - "gold customers" = customers with loyalty_tier = 'GOLD'
-- - "at risk" = haven't ordered in 60+ days
SELECT
c.customer_id,
c.customer_name,
c.email,
c.loyalty_tier,
MAX(o.order_date) as last_order,
SUM(o.order_amount) as lifetime_value
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id
WHERE c.loyalty_tier = 'GOLD'
AND DATEDIFF(day, MAX(o.order_date), CURRENT_DATE()) > 60
GROUP BY c.customer_id, c.customer_name, c.email, c.loyalty_tier;
Advanced Features
Query Optimization Suggestions
-- Copilot analyzes and suggests improvements
-- Original query: SELECT * FROM large_table WHERE date > '2024-01-01'
-- Copilot suggests:
-- 1. "Add a clustering key on 'date' column for better performance"
-- 2. "Consider using partition pruning with specific date range"
-- 3. "This table has 1B rows - consider adding a warehouse size hint"
-- Optimized query
SELECT
customer_id,
order_amount,
order_date
FROM large_table
WHERE date >= '2024-01-01'
AND date < '2024-02-01'
CLUSTER BY (date);
Anomaly Detection
-- Copilot identifies anomalies
-- User: "Are there any unusual patterns in my data?"
WITH daily_stats AS (
SELECT
DATE_TRUNC('day', order_date) as day,
COUNT(*) as order_count,
AVG(order_amount) as avg_amount
FROM orders
WHERE order_date >= DATEADD(month, -3, CURRENT_DATE())
GROUP BY 1
),
stats_with_zscore AS (
SELECT
day,
order_count,
avg_amount,
(order_count - AVG(order_count) OVER()) / STDDEV(order_count) OVER() as z_score
FROM daily_stats
)
SELECT *
FROM stats_with_zscore
WHERE ABS(z_score) > 2
ORDER BY day;
Copilot improves with usage. Provide feedback on generated queries to help it learn your data patterns and business context. Use specific, descriptive table and column names for better results.
Copilot Best Practices
| Practice | Example | Benefit |
|---|---|---|
| Be specific | "Top 10 customers by revenue in Q4" | Better SQL |
| Use business terms | "Gold tier customers" | Context awareness |
| Ask follow-ups | "Now group by region" | Iterative analysis |
| Request explanations | "Explain this query" | Learning |
| Provide feedback | Thumbs up/down | Model improvement |
- Copilot uses NLP to convert natural language to SQL
- Schema awareness enables contextual query generation
- Smart suggestions provide follow-up analysis options
- Query optimization recommendations improve performance
- Continuous learning improves accuracy over time