Source
yaml
id: csv-duckdb-slack
namespace: company.team
tasks:
- id: analyze_sales
type: io.kestra.plugin.jdbc.duckdb.Query
sql: >
INSTALL httpfs;
LOAD httpfs;
SELECT sum(total) as total, avg(quantity) as avg_quantity
FROM
read_csv_auto('https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv',
header=True);
fetchType: FETCH
- id: slack
type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
payload: >
{"channel": "#reporting",
"text": "Current Sales numbers: total sales is `${{ outputs.analyze_sales.rows[0].total }}` and average sales quantity is `{{ outputs.analyze_sales.rows[0].avg_quantity }}`"
}
triggers:
- id: every_monday
type: io.kestra.plugin.core.trigger.Schedule
cron: 0 9 * * MON
About this blueprint
Trigger SQL Schedule Outputs Notifications DuckDB
This flow will read a CSV file, analyze it with DuckDB, and send the results via Slack.
This flow assumes SLACK_WEBHOOK
Secret.
If you use MotherDuck, use Kestra Secret to store the MotherDuck service token. Then, add the url
property to point the task to your MotherDuck database.
yaml
- id: transform
type: io.kestra.plugin.jdbc.duckdb.Query
url: "jdbc:duckdb:md:my_db?motherduck_token={{ secret('MOTHERDUCK_TOKEN') }}"