Blueprints

Getting started with Kestra — a Business Automation workflow example

Source

yaml
id: business-automation
namespace: tutorial
labels:
  name: Business Automation

tasks:
  - id: working_directory
    type: io.kestra.plugin.core.flow.WorkingDirectory
    description: Provide a clean working directory for downstream tasks.
    tasks:
      - id: query
        type: io.kestra.plugin.jdbc.sqlite.Queries
        description: Create and populate the SQLite features table, then return the rows.
        url: jdbc:sqlite:kestra.db
        fetchType: STORE
        sql: |
          CREATE TABLE IF NOT EXISTS features (
              id INTEGER PRIMARY KEY,
              name TEXT NOT NULL,
              description TEXT NOT NULL,
              release_version TEXT NOT NULL,
              edition TEXT NOT NULL
          );

          DELETE FROM features;

          INSERT INTO features (name, description, release_version, edition)
          VALUES 
              ('Worker Groups', 'Allows targeting specific tasks or triggers to run on specific remote workers for better scalability and resource management.', '0.10', 'Enterprise'),
              ('Realtime Triggers', 'Supports triggering event-driven workflows in real-time.', '0.17', 'Open-Source'),
              ('Task Runners', 'Provides on-demand remote execution environments for running tasks.', '0.16', 'Open-Source'),
              ('KV Store', 'Adds key-value storage for persisting data across workflow executions.', '0.18', 'Open-Source'),
              ('SCIM Directory Sync', 'Allows synchronization of users and groups from Identity Providers.', '0.18', 'Enterprise');  
              
          SELECT * FROM features
          ORDER BY release_version;

      - id: to_csv
        type: io.kestra.plugin.serdes.csv.IonToCsv
        description: Convert the query results to a CSV file.
        from: "{{ outputs.query.outputs[0].uri }}"

      - id: to_excel
        type: io.kestra.plugin.serdes.excel.IonToExcel
        description: Convert the query results to an Excel file.
        from: "{{ outputs.query.outputs[0].uri }}"

description: |
  # Flow Description
  **Use case:** Business automation that assembles product feature data and exports it for sharing.
  **Highlights:**
  - Prepare a clean working directory, then build and populate a SQLite table of Kestra features.
  - Return the ordered feature list as query results for inspection.
  - Convert the dataset to both CSV and Excel so stakeholders can consume it in their preferred format.

About this blueprint

Getting Started SQL

This flow demonstrates how to use the SQLite plugin to create a table, insert data, and query the data. The flow then converts the query result to CSV and Excel files, allowing those to be shared with business stakeholders for further analysis and reporting.

Working Directory

Queries

Ion To Csv

Ion To Excel

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra