Blueprints

Getting started with Kestra — a Business Automation workflow example

Source

yaml
id: business-automation
namespace: tutorial
description: Business Automation

tasks:
  - id: working_directory
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: create_table
        type: io.kestra.plugin.jdbc.sqlite.Query
        url: jdbc:sqlite:kestra.db
        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
          );

      - id: empty_table
        type: io.kestra.plugin.jdbc.sqlite.Query
        url: jdbc:sqlite:kestra.db
        sql: DELETE FROM features;

      - id: insert_data
        type: io.kestra.plugin.jdbc.sqlite.Query
        url: jdbc:sqlite:kestra.db
        sql: >
          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');  

      - id: query
        type: io.kestra.plugin.jdbc.sqlite.Query
        url: jdbc:sqlite:kestra.db
        fetchType: STORE
        sql: |
          SELECT * FROM features
          ORDER BY release_version;

      - id: to_csv
        type: io.kestra.plugin.serdes.csv.IonToCsv
        from: "{{ outputs.query.uri }}"

      - id: to_excel
        type: io.kestra.plugin.serdes.excel.IonToExcel
        from: "{{ outputs.query.uri }}"

About this blueprint

Getting Started Postgres Software Engineering

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 a CSV and Excel files allowing those to be shared with business stakeholders for further analysis and reporting.

Working Directory

Query

Ion To Csv

Ion To Excel

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra