New to Kestra?
Use blueprints to kickstart your first workflows.
Run a Python ETL flow on Kestra that pulls API data with pandas, loads it into Postgres, and uploads a JSON copy to Amazon S3, fully orchestrated.
This blueprint runs a Python-based ETL pipeline that extracts JSON data from a REST API, loads it into a Postgres table, and archives a copy of the dataset to Amazon S3. It solves a common data engineering need: turning a raw HTTP endpoint into queryable warehouse rows while keeping an immutable file copy in object storage, all without standing up a separate ingestion service or scheduler. Use it as a starting point for API ingestion, reverse ETL staging, or any extract-load workflow that pairs a relational database with cloud object storage.
api_to_postgres task (io.kestra.plugin.scripts.python.Script) runs Python in a Docker container. Kestra installs the declared dependencies (requests, pandas, psycopg2, sqlalchemy) before the script starts.gorest.co.in users API with requests, builds a pandas DataFrame, and tags each row with an inserted_from column.DB_PASSWORD secret) and appends the rows to the users table via to_sql, then writes users.json as a captured outputFiles artifact.s3_upload task (io.kestra.plugin.aws.s3.Upload) takes that users.json output file and uploads it to the kestraio bucket in eu-central-1, authenticating with the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY secrets.A cron job or a standalone script can run the Python, but it cannot give you event-driven triggers, automatic retries on a flaky API call, run-level lineage between the extract and the upload, or a declarative definition the whole team can read. Postgres itself has no scheduler to coordinate the downstream S3 archive. Kestra wires the two tasks together, passes the users.json artifact across them, and gives you logs, replays, and observability for the full pipeline in one place.
users table (or permission to create one).DB_PASSWORD: password for the Postgres connection.AWS_ACCESS_KEY_ID: AWS access key for S3 uploads.AWS_SECRET_ACCESS_KEY: AWS secret key for S3 uploads.DB_PASSWORD, AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY secrets to your Kestra instance.host and connection string in the script, plus the S3 bucket and region, to match your environment.users table and users.json appears in your bucket.Schedule trigger or a webhook trigger to run the pipeline on a cadence or on demand.if_exists="append" strategy for an upsert, or add a dbt or SQL transform task after the load.