Queries icon
SlackIncomingWebhook icon
Schedule icon

Run scheduled sales analytics on CSV data with DuckDB and post results to Slack

Run SQL analytics on a CSV with DuckDB and Kestra, then post weekly sales metrics straight to Slack. No data warehouse or ETL required.

Categories
Data

Run SQL analytics directly on a CSV file with DuckDB, then push the results to Slack on a weekly schedule, no data warehouse, no ETL, and no manual spreadsheet checks. This blueprint reads a remote CSV over HTTP, computes sales KPIs in place with DuckDB, and delivers a formatted summary to a Slack channel every Monday morning, turning a flat file into an automated business report your team can read without logging into anything.

How it works

  1. The every_monday trigger (io.kestra.plugin.core.trigger.Schedule) fires on the cron 0 9 * * MON, starting the flow at 9 AM every Monday.
  2. The analyze_sales task (io.kestra.plugin.jdbc.duckdb.Queries) installs and loads the DuckDB httpfs extension, then runs read_csv_auto against a remote orders.csv to compute sum(total) as total revenue and avg(quantity) as average order quantity. With fetchType: FETCH, the rows are returned as task outputs.
  3. The slack task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts a formatted message to your channel, interpolating outputs.analyze_sales.rows[0].total and outputs.analyze_sales.rows[0].avg_quantity into the text.

What you get

  • In-place SQL analytics on a CSV file with zero ingestion or staging tables.
  • A scheduled weekly KPI report (total revenue and average order quantity) delivered to Slack.
  • A self-contained DuckDB query that reads remote files over HTTP via httpfs.
  • Outputs that any downstream task can reuse for alerting, dashboards, or storage.

Who it's for

  • Data and analytics engineers who want lightweight reporting without a warehouse.
  • Business and operations teams that live in Slack and want metrics pushed to them.
  • Anyone prototyping analytics on CSV or flat-file data sources.

Why orchestrate this with Kestra

DuckDB is a query engine, not a scheduler: it cannot fire on a cron, retry a failed run, alert a channel, or track which inputs produced which outputs. Kestra fills that gap. The Schedule trigger runs the analysis on an event-driven cron, tasks can retry transient HTTP or network failures, every execution is captured with full logs and lineage, and the whole pipeline is declarative YAML you can version, review, and reuse. You get the speed of DuckDB SQL with the reliability and visibility of a real orchestrator.

Prerequisites

  • A Kestra instance with the DuckDB (jdbc) and Slack plugins available.
  • A Slack incoming webhook URL for the channel that should receive the report.
  • Network access from your workers to the CSV source over HTTP.

Secrets

  • SLACK_WEBHOOK: the Slack incoming webhook URL used by the slack task.

Quick start

  1. Create a Slack incoming webhook and store its URL as the SLACK_WEBHOOK secret.
  2. Add this blueprint to a namespace in your Kestra instance.
  3. (Optional) Point read_csv_auto at your own CSV URL and adjust the SQL to your metrics.
  4. Execute the flow once manually to confirm the Slack message arrives, then let the Monday schedule take over.

How to extend

  • Swap the remote CSV for files in S3, GCS, or Azure (DuckDB httpfs and the secrets extension support cloud object storage).
  • Add more aggregations or window functions to enrich the KPIs in the analyze_sales query.
  • Change the cron to daily or hourly, or add a manual input to run on demand.
  • Run the same SQL against a cloud-hosted MotherDuck database by setting url: "jdbc:duckdb:md:my_db?motherduck_token={{ secret('MOTHERDUCK_TOKEN') }}" on the query task, no change to the SQL logic.
  • Fan out the results to email, a database, or a dashboard task alongside Slack.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.