Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.duvo.ai/llms.txt

Use this file to discover all available pages before exploring further.

Time to complete20–35 minutes
DifficultyIntermediate
PrerequisitesSnowflake connection (key-pair authentication), Optional: Slack, Gmail, Outlook, or Google Sheets
You’ll buildAssignments 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:
  • Snowflake connection — follow the Snowflake connection guide to configure key-pair authentication and add the connection on the Connections page
  • Slack connection (optional) — for threshold alerts and summaries. Click Enable on the Connections page and authorize with your Slack workspace
  • Gmail or Outlook connection (optional) — for email distribution of reports
  • Google Sheets connection (optional) — for writing query results to a spreadsheet

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

  1. Click ”+ Create Assignment” from your dashboard
  2. Select “Use Assignment Builder”

Step 2: Paste This SOP

Adapt the table names, columns, and metric names to match your warehouse schema:
Every Monday at 7:00 AM, generate a weekly business metrics summary.

Step 1: Query Snowflake for last week's metrics (Monday–Sunday).

Run these queries and collect the results:
- Total revenue: SELECT SUM(order_total) FROM orders WHERE order_date BETWEEN [last Monday] AND [last Sunday] AND status = 'completed'
- Order count: SELECT COUNT(*) FROM orders WHERE order_date BETWEEN [last Monday] AND [last Sunday]
- Average order value: calculate from the above
- Exception count (failed or refunded orders): SELECT COUNT(*) FROM orders WHERE order_date BETWEEN [last Monday] AND [last Sunday] AND status IN ('failed', 'refunded')

Step 2: Compare to the prior week by running the same queries for the previous Monday–Sunday period.

Step 3: Calculate week-over-week change as a percentage for each metric.

Step 4: Format a short summary message:
"Weekly Metrics — [date range]
- Revenue: $[value] ([+/-X%] vs prior week)
- Orders: [count] ([+/-X%])
- Avg order value: $[value] ([+/-X%])
- Exceptions: [count] ([+/-X%])

[If exceptions increased more than 20%, add: 'WARNING: Exception rate up — check the Orders table for details.']"

Step 5: Post the message to the #data-ops Slack channel.

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

  1. Go to Assignment Settings > Triggers
  2. Select Schedule
  3. 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

Every hour, check for inventory levels that require attention.

Step 1: Run this query in Snowflake:
SELECT sku, product_name, quantity_on_hand, reorder_point, warehouse_location
FROM inventory.stock_levels
WHERE quantity_on_hand < reorder_point
ORDER BY quantity_on_hand ASC

Step 2: If the query returns no rows, stop — no action needed.

Step 3: If any rows are returned:
- For each row, format a line: "• [product_name] (SKU [sku]) — [quantity_on_hand] units remaining at [warehouse_location] (reorder point: [reorder_point])"
- Assemble a Slack message:
  "Inventory Alert — [count] SKUs below reorder point:
  [lines from above]

  Action: Check your replenishment queue or place restock orders."

Step 4: Post the message to the #supply-chain Slack channel.
Step 5: Do not send a duplicate alert if the same SKUs were already alerted in the last 4 hours.

Step 3: Connect Required Integrations

Under Connections, enable:
  • Snowflake — required
  • Slack — for posting the alert

Step 4: Schedule the Assignment

  1. Go to Assignment Settings > Triggers
  2. Select Schedule
  3. 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

  1. Click ”+ Create Assignment” from your dashboard
  2. Select “Use Assignment Builder”

Step 2: Paste This SOP

Adapt the query and sheet name to your use case:
When started, export a fresh customer account list from Snowflake to Google Sheets.

Step 1: Run this query in Snowflake:
SELECT
  account_id,
  account_name,
  industry,
  annual_revenue,
  country,
  account_owner,
  created_date,
  last_activity_date
FROM crm.accounts
WHERE status = 'active'
ORDER BY annual_revenue DESC

Step 2: Write the results to the "Customer Accounts" Google Sheet:
- Use the first sheet ("Sheet1")
- Clear the existing content from row 2 downward (preserve the header row)
- Write the query results starting from row 2, with one row per account
- Use these column headers (already in row 1): Account ID, Account Name, Industry, Annual Revenue, Country, Account Owner, Created, Last Activity

Step 3: Add a note at the top of the sheet (cell A1 comment or a dedicated "last updated" cell):
"Last refreshed: [current date and time] — [row count] accounts"

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,000ormorethan1,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 DISTINCT or a GROUP BY
  • Confirm 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