Snowflake Workflows
Time to complete
20–35 minutes
Difficulty
Intermediate
Prerequisites
Snowflake connection (key-pair authentication), Optional: Slack, Gmail, Outlook, or Google Sheets
You'll build
Assignments that query your data warehouse and turn the results into reports, alerts, and actions
Why Use Snowflake with Duvo?
The Problem: Valuable business data sits in your data warehouse — inventory levels, revenue figures, pipeline metrics, exception counts. Getting it into the hands of decision-makers requires a data engineer, a BI dashboard, or a manual export. Ad-hoc questions take hours. Monitoring dashboards go unread. Alerts are configured once and forgotten.
The Solution: Duvo assignments can query Snowflake directly, interpret the results, and take action — sending a Slack message when a threshold is breached, writing a formatted report to Google Sheets, or summarizing warehouse trends in a Monday-morning email. No dashboards to maintain. No scheduled SQL scripts to babysit.
What you can achieve:
Deliver scheduled KPI summaries before your team's Monday standup
Get a Slack alert the moment inventory falls below a reorder threshold
Pull a fresh data extract into Google Sheets for a stakeholder who needs it in minutes
Monitor for anomalies across large datasets and escalate exceptions automatically
Before You Start
Make sure you have these ready:
Use Case 1: Scheduled KPI Report from Warehouse Data
Outcome: Every Monday morning, a summary of last week's key metrics — revenue, volume, exceptions — lands in your team's Slack channel. No one has to log into Snowflake or build a query.
This workflow queries Snowflake on a schedule, formats the results into a readable summary, and distributes it to the right people.
Step 1: Create Your Assignment
Click "+ Create Assignment" from your dashboard
Select "Use Assignment Builder"
Step 2: Paste This SOP
Adapt the table names, columns, and metric names to match your warehouse schema:
Step 3: Connect Required Integrations
Under Connections, enable:
Snowflake — required
Slack — for posting the summary (or substitute Gmail/Outlook for email delivery)
Step 4: Schedule the Assignment
Go to Assignment Settings > Triggers
Select Schedule
Set to Weekly on Monday at 7:00 AM in your timezone
Expected Results
A Slack summary appears in your channel before your Monday standup
Week-over-week comparisons show at a glance whether things are trending better or worse
Anomaly flags are surfaced automatically so the team knows when to dig deeper
No one needs to open Snowflake or write a query to get the numbers
Use Case 2: Threshold Alert When a Metric Breaches a Limit
Outcome: When inventory for a top SKU drops below the reorder point — or when a fraud rate, error count, or cost metric crosses a threshold — your team gets a Slack message immediately rather than discovering the problem hours later.
This workflow polls Snowflake on a short schedule, checks against defined limits, and alerts only when action is needed.
Step 1: Identify Your Threshold Condition
Before writing the SOP, decide:
Which table and column holds the metric you want to watch (e.g.,
inventory.quantity_on_hand)What value triggers an alert (e.g., less than 100 units, more than 5% error rate)
What context to include in the alert (e.g., which SKU, which region, current value, historical average)
Step 2: Paste This SOP
Step 3: Connect Required Integrations
Under Connections, enable:
Snowflake — required
Slack — for posting the alert
Step 4: Schedule the Assignment
Go to Assignment Settings > Triggers
Select Schedule
Set to Every hour (or every 15 minutes for time-critical metrics)
Expected Results
Alerts fire only when a threshold is actually breached — no noise when things are fine
Each alert names the specific SKUs or records requiring attention
Your team can act immediately instead of learning about the problem in a weekly report
The deduplication instruction prevents the same alert from firing repeatedly before anyone has had a chance to act
Use Case 3: Export Query Results to Google Sheets
Outcome: A stakeholder needs a fresh data pull from the warehouse — customer list, transaction export, regional breakdown — and it needs to be in a spreadsheet they can filter and share. The assignment runs the query and writes the results into a Google Sheet quickly.
This is useful for ad-hoc exports, recurring data pulls that feed downstream tools, or replacing manual "download CSV, clean it up, paste into Sheets" workflows.
Step 1: Create Your Assignment
Click "+ Create Assignment" from your dashboard
Select "Use Assignment Builder"
Step 2: Paste This SOP
Adapt the query and sheet name to your use case:
Step 3: Connect Required Integrations
Under Connections, enable:
Snowflake — required
Google Sheets — for writing results
Step 4: Run On Demand or Schedule It
On demand: click Start Work whenever you need a fresh pull
Scheduled: set a daily or weekly trigger under Assignment Settings > Triggers if the sheet needs to stay current automatically
Expected Results
The Google Sheet is populated with fresh data each time the assignment runs
Stakeholders can filter, sort, and share the sheet without touching Snowflake
The "last refreshed" cell makes it clear how current the data is
Large result sets are handled automatically — when results are too large to return inline, they may be provided as a CSV that the assignment can upload directly to the sheet
Tips for Better Results
Name your queries in the SOP: Label each query with what it measures (e.g., "Query 1: weekly revenue"). This makes it easier to refine specific queries without rewriting the entire SOP.
Use date ranges explicitly: Rather than WHERE date = CURRENT_DATE - 7, write out the range in plain language in your SOP (e.g., "from last Monday to last Sunday") and let the assignment calculate the exact dates at runtime. This avoids off-by-one errors from timezone differences.
Keep queries read-only: Duvo's Snowflake connection only allows SELECT statements. Design your workflow so any write operations happen via a different connection (Google Sheets, Slack, email) rather than back into Snowflake.
Add a sanity check: For reports that feed business decisions, add a line to your SOP like "If the total revenue figure is less than $1,000 or more than $10,000,000, stop and send me a Slack message saying the numbers look unexpected — do not distribute the report." This catches data pipeline issues before they mislead stakeholders.
Upload schema context to Files: If your warehouse has many tables or non-obvious column names, upload a data dictionary or schema summary to Assignment Settings > Files. The assignment can use it to write more accurate queries.
Troubleshooting
Assignment cannot connect to Snowflake
Re-open the Snowflake connection on the Connections page and verify the account identifier, username, warehouse, database, schema, and role
Check that the RSA public key is still registered in Snowflake under
ALTER USER ... SET RSA_PUBLIC_KEY = '...'Confirm the Snowflake user's role has USAGE on the warehouse and SELECT on the target tables
Queries are returning no rows unexpectedly
Run the same query manually in Snowflake's worksheet UI to confirm the result
Check that the warehouse is not suspended — if it cannot auto-resume (or resume is slow), queries may fail or time out rather than return results
Verify that the date range in the SOP is computing correctly; add a line asking the assignment to log the computed date range before querying
Report numbers look wrong
Check for timezone differences: Snowflake stores timestamps in UTC by default. If your SOP says "last week" without specifying a timezone, add one (e.g., "last Monday to last Sunday, US Eastern time")
Look for duplicate rows: if your table has one row per event and the query isn't aggregating correctly, add
SELECT DISTINCTor aGROUP BYConfirm the Snowflake role can see all the rows you expect — row-level security policies can silently filter results
Large result sets are not appearing in Google Sheets
When results are too large to return inline, they may be provided as a CSV file. The assignment can upload the CSV directly to Google Sheets — update your SOP to say: "If the query result is a CSV file, upload it to the Google Sheet"
Scheduled Jobs are not running
Confirm the trigger is set to Active under Assignment Settings > Triggers
Check the assignment's Job history to see whether previous scheduled Jobs succeeded or failed
If Jobs are failing, open the failed Job and read the run log to identify the error
Related Resources
Last updated