New to Kestra?
Use blueprints to kickstart your first workflows.
Extract multiple Postgres tables in parallel using SQL and transform them into a bestsellers report with Python and Pandas in Kestra, on a daily schedule.
Pull multiple tables out of a Postgres database in parallel, hand the raw CSV exports to a Python task, and turn them into an analytics-ready bestsellers report with Pandas. This blueprint solves a common ETL problem: your transactional data lives in Postgres, but the joins, aggregations, and ranking you need for reporting are easier (and faster) to express in Pandas than in raw SQL, and you want the whole thing to run unattended every morning.
get_tables step of type io.kestra.plugin.core.flow.Parallel runs two
extractions at once, capped at concurrent: 2.io.kestra.plugin.jdbc.postgresql.CopyOut tasks (products
and orders) stream SELECT * FROM products and SELECT * FROM orders
straight to CSV files in Kestra's internal storage.pandas task of type io.kestra.plugin.scripts.python.Script mounts both
outputs through inputFiles ({{ outputs.products.uri }} and
{{ outputs.orders.uri }}) and runs on a Docker taskRunner with the
pandas dependency installed.orders with products on
product_id, groups by product_name, sums total, sorts descending,
and writes the top 10 to bestsellers_pandas.json via outputFiles.Schedule trigger (every_morning, cron 0 9 * * *) runs the pipeline
daily at 09:00.pluginDefaults.Postgres can schedule jobs with pg_cron, but it cannot orchestrate work that leaves the database. Kestra ties the SQL extraction, the Python transform, and the daily schedule into one declarative YAML flow with built-in retries, parallelism, output passing between tasks, and full execution lineage. The Docker task runner keeps Python dependencies reproducible without touching the database server.
jdbc:postgresql://{{ vars.db_host }}:5432/ with user postgres).products and orders tables sharing a product_id column, plus a
total column on orders.DB_PASSWORD: the password for the Postgres postgres user, referenced in
pluginDefaults as {{ secret('DB_PASSWORD') }}.DB_PASSWORD secret.db_host variable to point at your database.every_morning schedule enabled for daily runs.CopyOut tasks inside Parallel to pull additional tables.bestsellers_pandas.json to a warehouse, object store, or dashboard
with a follow-up task.