Schedule icon
Request icon
Query icon
Parallel icon
If icon
Log icon

Automated Data Ingestion and Parallel Quality Validation with DuckDB

Schedule JSON ingestion and run parallel null, volume, and price-range quality checks with DuckDB. Conditional routing alerts on failures.

Categories
Data

Overview

Data quality issues, null keys, unexpected volumes, or out-of-range values, compound silently and corrupt downstream dashboards and ML models. This blueprint provides a self-contained, scheduled pipeline that ingests a JSON dataset from an HTTP endpoint, stages it inside an embedded DuckDB database, runs three independent validation assertions in parallel, and conditionally routes the execution based on whether every check passes.

No external infrastructure is required. DuckDB runs fully in-memory inside the Kestra worker, making this pattern equally effective on a local laptop and a production Kubernetes cluster.

How it works

  1. Schedule Trigger, fires daily at 06:00 UTC via a cron trigger.
  2. HTTP Ingestion, the io.kestra.plugin.core.http.Request task fetches a JSON products dataset from a public REST API.
  3. DuckDB Staging, io.kestra.plugin.jdbc.duckdb.Query uses json_extract and unnest to parse the nested JSON payload and materialise a typed relational table (products) in-memory with id, title, category, price, and stock columns.
  4. Parallel Validation, a Parallel block fires three sibling DuckDB queries concurrently:
    • Null check: counts any rows where id IS NULL.
    • Volume check: counts total ingested rows and asserts ≥ 50.
    • Price-range check: counts any products with price <= 0.
  5. Conditional Branching, the If task reads the three query outputs via Pebble expressions. A clean run logs a ✅ success message; any failure logs a ⚠️ warning with all three metric values included.

What you get

  • A zero-infrastructure data quality framework using embedded DuckDB, no Spark, no Snowflake, no external orchestrator.
  • True parallel test execution: the three checks run simultaneously, not sequentially.
  • A ready-to-extend pattern: swap the HTTP endpoint, add more SQL assertions, or wire the else branch to Slack, PagerDuty, or an email notification task.
  • Declarative, version-controlled pipeline YAML that is easy to review in pull requests.

Who it's for

  • Analytics Engineers building lightweight data testing frameworks without a dedicated dbt-test pipeline.
  • Data Platform teams who need fast quality gates before triggering downstream transformation or reporting jobs.
  • Backend developers who want to add observable data validation to event-driven ingestion workflows.

Why orchestrate this with Kestra

  • Declarative YAML, the entire pipeline including triggers, branching logic, and metadata lives in one reviewable file.
  • Parallel execution, Kestra's native Parallel task eliminates the need for custom thread pools or async glue code.
  • Built-in observability, every task output, duration, log line, and execution state is captured automatically in the Kestra UI.
  • Retries and error handling, add retry and allowFailure blocks to any task without changing application code.
  • DuckDB integration, the plugin-jdbc-duckdb plugin runs analytical SQL directly in the worker process, with no connection string or credentials required.

Prerequisites

  • Kestra 0.17.0 or later.
  • The kestra-io/plugin-jdbc plugin bundle (includes DuckDB), included by default in the official Kestra Docker image.
  • Internet connectivity from the Kestra worker to reach dummyjson.com (or replace with your own endpoint).

Getting Started

  1. Open the Kestra UI and navigate to Flows → Create.
  2. Paste the YAML from this blueprint into the editor.
  3. Click Save, then Execute to trigger an immediate run.
  4. Select the execution and open the Outputs tab to inspect each task's query result.
  5. Switch to the Logs tab and verify the quality gate verdict message.

Customization & Extension

  • Swap the data source: replace the uri in fetch-remote-data with your own internal API, S3 presigned URL, or Postgres export task.
  • Add more assertions: clone any of the three DuckDB query tasks inside the Parallel block, Kestra executes all of them concurrently at zero extra scheduling cost.
  • Persist results: replace store: true on the staging task with a CopyIn task to write the table to S3, GCS, or an external database after validation passes.
  • Alert on failure: in the else branch, add a io.kestra.plugin.slack.notifications.SlackIncomingWebhook task or a io.kestra.plugin.email.MailSend task to notify your team in real time.
  • Parameterise thresholds: convert the hardcoded 50 row-count minimum to a flow input so different namespaces can configure their own volume thresholds without duplicating the flow.
Orchestrate with Kestra
Orchestrate DuckDB with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.