From a7392c28e842dbb030ff80183dbc0f7d1eea546c Mon Sep 17 00:00:00 2001 From: Anna Geller Date: Tue, 3 Dec 2024 17:49:52 +0100 Subject: [PATCH] fix: blueprints --- business-automation.yaml | 26 +++++++------------------- dwh-and-analytics.yaml | 5 ++--- infrastructure-automation.yaml | 6 +++--- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/business-automation.yaml b/business-automation.yaml index 1aa5b57..824326a 100644 --- a/business-automation.yaml +++ b/business-automation.yaml @@ -6,9 +6,10 @@ tasks: - id: working_directory type: io.kestra.plugin.core.flow.WorkingDirectory tasks: - - id: create_table - type: io.kestra.plugin.jdbc.sqlite.Query + - id: query + type: io.kestra.plugin.jdbc.sqlite.Queries url: jdbc:sqlite:kestra.db + fetchType: STORE sql: | CREATE TABLE IF NOT EXISTS features ( id INTEGER PRIMARY KEY, @@ -18,39 +19,26 @@ tasks: edition TEXT NOT NULL ); - - id: empty_table - type: io.kestra.plugin.jdbc.sqlite.Query - url: jdbc:sqlite:kestra.db - sql: DELETE FROM features; + 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 }}" + from: "{{ outputs.query.outputs[0].uri }}" - id: to_excel type: io.kestra.plugin.serdes.excel.IonToExcel - from: "{{ outputs.query.uri }}" + from: "{{ outputs.query.outputs[0].uri }}" extend: title: Getting started with Kestra — a Business Automation workflow example diff --git a/dwh-and-analytics.yaml b/dwh-and-analytics.yaml index ac905b6..a659d51 100644 --- a/dwh-and-analytics.yaml +++ b/dwh-and-analytics.yaml @@ -39,14 +39,13 @@ tasks: taskRunner: type: io.kestra.plugin.scripts.runner.docker.Docker containerImage: ghcr.io/kestra-io/duckdb:latest - script: > + script: | import duckdb import pandas as pd conn = duckdb.connect(database='dbt.duckdb', read_only=False) - tables_query = "SELECT table_name FROM information_schema.tables WHERE - table_schema = 'main';" + tables_query = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'main';" tables = conn.execute(tables_query).fetchall() diff --git a/infrastructure-automation.yaml b/infrastructure-automation.yaml index ab79866..5293df6 100644 --- a/infrastructure-automation.yaml +++ b/infrastructure-automation.yaml @@ -15,7 +15,7 @@ tasks: RUN pip install --no-cache-dir kestra tags: - "{{ inputs.docker_image }}" - push: false + push: false # you can change this to true after adding credentials credentials: registry: https://index.docker.io/v1/ username: "{{ secret('DOCKERHUB_USERNAME') }}" @@ -23,7 +23,7 @@ tasks: - id: run_container type: io.kestra.plugin.docker.Run - pullPolicy: NEVER + pullPolicy: NEVER # to use the local image we've just built containerImage: "{{ inputs.docker_image }}" commands: - pip @@ -40,7 +40,7 @@ tasks: outputFiles: - "*.txt" inputFiles: - main.tf: > + main.tf: | terraform { required_providers { http = {