New to Kestra?
Use blueprints to kickstart your first workflows.
Run a N1QL query against Couchbase, load the rows into a Pandas DataFrame, aggregate, and export a CSV. A reusable NoSQL-to-Python ETL pattern in Kestra.
Pull structured documents out of a Couchbase NoSQL database and turn them into analytics-ready data with Python and Pandas. This blueprint solves a common gap: Couchbase is great for fast operational reads and writes, but it is not where you want to run grouping, counting, and reshaping logic for reporting. Here Kestra runs a N1QL query, hands the rows to a Python script, and produces a clean CSV you can feed into a warehouse, a dashboard, or a downstream flow.
query_couchbase task (io.kestra.plugin.couchbase.Query) connects to a
Couchbase cluster over a connectionString and runs a N1QL query against the
travel-sample.inventory.airline collection, selecting id, country,
name, type, iata, and icao. With fetchType: FETCH, every matching row
is returned in outputs.query_couchbase.rows.pandas task (io.kestra.plugin.scripts.python.Script) declares pandas
as a dependency, loads the rows into a pandas.DataFrame, groups by country
and counts airlines per country, then writes the aggregation to final.csv.final.csv is captured through the task's outputFiles, making it a first-class
output you can pass to other tasks or download from the execution.travel-sample data.Couchbase has no built-in scheduler to drive cross-system pipelines, and a standalone
Python script gives you no retries, no lineage, and no scheduling. With Kestra you get
declarative YAML, automatic retries on transient failures, full execution logs and
outputs for lineage, and event or schedule triggers so the extract runs on its own.
The Python dependency (pandas) is installed per run, so the flow stays portable.
travel-sample bucket loaded.This example uses inline literal credentials (username, password) and a static
connectionString for the sample dataset, so no Kestra secrets are referenced. For
any real cluster, replace those literals with {{ secret('COUCHBASE_USERNAME') }},
{{ secret('COUCHBASE_PASSWORD') }}, and a secret-backed connectionString.
docker run -d --name db -p 8091-8096:8091-8096 -p 11210-11211:11210-11211 couchbase.http://localhost:8091/, choose "Setup New Cluster", and set an admin user and password.travel-sample bucket from the Sample Buckets section.connectionString, username, and password to match your cluster.final.csv.query to target other buckets, scopes, or collections.final.csv to object storage or a database.