WorkingDirectory icon
Queries icon
IonToCsv icon
IonToExcel icon

Business Automation workflow example: Getting started with Kestra

Use Kestra to create and query a SQLite table, then export the results to CSV and Excel files that business stakeholders can open and analyze.

Categories
Getting StartedBusinessCore

Turn raw operational data into shareable business reports with a SQLite-backed workflow. This blueprint creates a SQLite table, populates it, queries the rows, and exports the result set as both CSV and Excel files, so analysts and business stakeholders can open the data in the tools they already use. It is a practical getting started example for data preparation, reporting, and lightweight ETL with Kestra.

How it works

  1. The working_directory task (io.kestra.plugin.core.flow.WorkingDirectory) provides a clean, isolated working directory so downstream tasks share files reliably within the execution.
  2. The query task (io.kestra.plugin.jdbc.sqlite.Queries) connects to a SQLite database at jdbc:sqlite:kestra.db, creates the features table if it does not exist, clears it, inserts the feature rows, and runs a SELECT ordered by release_version. With fetchType: STORE, the result set is stored in Kestra internal storage and exposed as a downloadable file URI.
  3. The to_csv task (io.kestra.plugin.serdes.csv.IonToCsv) reads the stored query output ({{ outputs.query.outputs[0].uri }}) and converts it to a CSV file.
  4. The to_excel task (io.kestra.plugin.serdes.excel.IonToExcel) converts the same query output into an Excel spreadsheet.

What you get

  • A reproducible SQLite table created and populated from declarative SQL.
  • An ordered, queryable result set stored in Kestra internal storage.
  • Ready-to-share CSV and Excel exports of the same dataset.
  • A clean working directory that keeps task outputs consistent within the run.

Who it's for

  • Data analysts who need quick, repeatable exports for stakeholders.
  • Data engineers prototyping a lightweight ETL or reporting pipeline.
  • Newcomers learning how to combine a database query with file serialization in Kestra.

Why orchestrate this with Kestra

SQLite has no built-in scheduler, retry logic, or way to fan a query result out to multiple file formats. Kestra wraps the whole sequence in declarative YAML: add triggers to run on a schedule or in response to events, attach retries to handle transient failures, and rely on full execution lineage so every run, input, and output file is logged and downloadable. The serialization tasks turn one query into multiple consumable formats without any glue code, something the database engine alone cannot do.

Prerequisites

  • A running Kestra instance.
  • No external database is required; the flow uses an embedded SQLite database file.

Secrets

This flow references no secrets. All connection details are embedded in the SQLite JDBC URL, so it runs as-is with no credential configuration.

Quick start

  1. Add this flow to your Kestra instance.
  2. Trigger an execution from the UI.
  3. Inspect the query task output to review the ordered feature rows.
  4. Download the CSV and Excel files produced by to_csv and to_excel from the execution outputs.

How to extend

  • Point the query task at a production database (Postgres, MySQL, or another JDBC source) by swapping the plugin type and url.
  • Replace the sample features data with your own SQL to report on real business entities.
  • Add a triggers block to refresh the export on a Schedule or in response to upstream events.
  • Send the generated files onward with an email, Slack, or object storage task so reports land directly in stakeholders' hands.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.