database-snapshot-report
Run a SQL query, render a PDF preview, attach the full CSV, email it. Designed for the most common business automation: "send me X every Monday morning."
Use case
Sales summary, signups by day, error counts, queue depth, anything you'd otherwise log into a database to check by hand. Replace 2 minutes of clicking around with one scheduled email.
This is a YAML workflow, not a skill — pure plumbing, no AI value.
Setup
- Create a
sqlcredential pointing at your database (vendor + server + login) - Create an
emailcredential for SMTP delivery (host, user, password, fromAddress) - Edit the
statementinworkflow.yamlfor your query - Set the
to:address on the email task - Schedule (daily, weekly, monthly — whatever fits)
Pipeline
- run-query —
sqlexport→ writes a CSV with column headers - format-preview —
runtimeenv(bash +column) → fixed-width preview of top 100 rows - render-pdf —
pdfgenerate→ PDF from the preview text (Courier so columns stay aligned) - email-report —
emailsend→ both files attached, short body explains the contents
Why both PDF and CSV
The PDF is for skimming on a phone. The CSV is for opening in Excel/Sheets to sort, filter, or chart. Recipients pick the format that fits the moment.
Customization
- Bigger reports — bump
head -n 101to show more rows in the PDF preview, or skip the PDF entirely and just attach the CSV - Multi-query reports — chain multiple
run-querytasks each writing to a different CSV, attach all of them - Slack instead of email — replace the email task with a
messagetask targeting a user; CSV/PDF won't attach to a chat message, so just embed the preview text in the body - Charts — for visual reports, pipe the CSV through
gnuplotor a Python plot script in a runtimeenv task and attach the PNG
Notes
${INTOUCH_HOME}/reports/must exist (mkdir at first use, or have the script create it)- The
column -tformatter handles most CSVs but breaks on cells containing commas — for those, switch to a tab-delimited export (outputDelimiter: tab) andcolumn -t -s$'\t'
Source
See workflow.yaml.