Schedule icon
Download icon
Queries icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon

Zero-Warehouse Lakehouse Curation and Parquet Export with DuckDB

Declarative Lakehouse curation pipeline that audits raw batch data in DuckDB, enforces quality gates, exports analytical Parquet, and alerts Slack.

Categories
BusinessData

Modern analytics teams often face a dilemma: provisioning a full cloud data warehouse (Snowflake, BigQuery, Redshift) is costly and complex for staging workflows, while basic shell scripts lack auditability, scheduling, and error isolation.

This blueprint implements a serverless, zero-warehouse Lakehouse curation pipeline powered by embedded DuckDB and Kestra. It downloads raw transactional batches, validates data quality in memory (checking for empty sets, null primary keys, and invalid amounts), applies window functions to enrich customer spend ranks, stores the curated dataset as compressed columnar Parquet, and broadcasts a KPI scorecard straight to Slack.

How it works

  1. Scheduled Ingestion: The daily_lakehouse_schedule trigger (io.kestra.plugin.core.trigger.Schedule) fires automatically at 06:00 UTC, or runs on-demand with custom input URLs.
  2. Raw File Ingestion: The fetch_raw_batch task (io.kestra.plugin.core.http.Download) pulls the target CSV file into Kestra managed storage.
  3. Quality Profiling: The validate_and_profile task (io.kestra.plugin.jdbc.duckdb.Queries) uses DuckDB to audit the data in memory. With fetchType: FETCH, it extracts row counts, null counts, and financial totals into task outputs.
  4. Quality Gate Evaluation: The quality_gate flowable task (io.kestra.plugin.core.flow.If) verifies that total rows satisfy min_expected_rows and that zero corrupt primary keys or non-positive totals exist.
  5. Parquet Curation: If validation succeeds, curate_and_export_parquet applies analytical window aggregations (AVG() OVER (PARTITION BY ...) and DENSE_RANK()) and persists the output via fetchType: STORE as an optimized internal artifact.
  6. Slack KPI Broadcast: The notify_slack_kpi task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) dispatches a rich message containing revenue and customer metrics.
  7. Audit Lineage: The export_curation_metadata task records execution lineage and quality verification flags for compliance audits.

What you get

  • In-memory SQL data quality checks before bad data can pollute your lakehouse.
  • Automated conversion from raw CSV to columnar, analytical Parquet.
  • Zero cloud warehouse compute bills for staging and curation.
  • Instant Slack visibility on daily gross revenue, average order value, and row counts.
  • Full end-to-end execution logs and data lineage in Kestra.

Who it's for

  • Data engineers building lightweight lakehouse pipelines without heavy cluster infrastructure.
  • Analytics engineers looking for automated data contract validation.
  • FinOps-conscious teams optimizing warehouse spend by curating data with DuckDB before loading.

Why orchestrate this with Kestra

DuckDB is an analytical execution engine, but it cannot schedule recurring jobs, trigger notifications, enforce branching workflows, or store execution state. Kestra turns DuckDB into a resilient data platform: tasks can be chained, secrets are secured, quality gates branch conditionally, and all intermediate artifacts are managed with reproducible lineage.

Prerequisites

  • A running Kestra instance.
  • (Optional) A Slack Incoming Webhook URL to receive the KPI summary.

Secrets

  • SLACK_WEBHOOK_URL: Your Slack Incoming Webhook URL. If omitted for local testing, the quality gate handles standard execution without external side-effects.

Quick start

  1. Add the flow YAML to your Kestra instance.
  2. Set the SLACK_WEBHOOK_URL secret if Slack alerting is desired.
  3. Click Execute in the UI to run against the default public dataset.
  4. View the generated Parquet artifact in the Outputs tab.

How to extend

  • Add io.kestra.plugin.aws.s3.Upload or io.kestra.plugin.gcp.gcs.Upload inside the then: block to sync the curated Parquet file to an external cloud data lake.
  • Replace the Slack webhook with io.kestra.plugin.notifications.mail.MailSend for executive email reporting.
  • Point inputs.data_url to pre-signed S3 or GCS URLs for private internal datasets.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.