New to Kestra?
Use blueprints to kickstart your first workflows.
Event driven Kestra pipeline that reacts to new Postgres rows, lands data in S3 and Databricks in parallel, runs a Databricks job, and validates results with pandas.
Build an event driven lakehouse ingestion pipeline without writing a scheduler or a single polling script. This Kestra blueprint watches a Postgres staging table, and as soon as new rows appear it fans the data out to Amazon S3 and Databricks in parallel, kicks off a Databricks aggregation job, queries the aggregated result over Databricks SQL, and runs a pandas based data quality gate that flags bad records before anyone downstream consumes them.
pg_trigger trigger (io.kestra.plugin.jdbc.postgresql.Trigger) polls the staging_data table every two minutes and starts an execution whenever the query returns rows, storing the result set as the trigger output.json task (io.kestra.plugin.serdes.json.IonToJson) converts the fetched rows from Ion to JSON.parallel task (io.kestra.plugin.core.flow.Parallel) lands the file twice at once: s3_store (io.kestra.plugin.aws.s3.Upload) writes a timestamped object to S3 for the raw archive, while databricks_store (io.kestra.plugin.databricks.dbfs.Upload) pushes the same file to DBFS.create_job task (io.kestra.plugin.databricks.job.CreateJob) launches your existing Databricks aggregation job. Databricks authentication is shared through pluginDefaults, so the host and token are declared once.query_data_set task (io.kestra.plugin.databricks.sql.Query) reads the aggregated table back through a SQL warehouse, and csv (io.kestra.plugin.serdes.csv.IonToCsv) converts it to CSV.check_data task (io.kestra.plugin.scripts.python.Commands) runs an inline pandas script that counts null rows and negative quantities, publishing num_errors as an output. The if task (io.kestra.plugin.core.flow.If) logs a warning when any issues are found.pluginDefaults instead of repeating them on every task.Wiring this by hand means a poller, an S3 uploader, a Databricks API client, and a QA script, each with its own retries, secrets, and logging. Kestra collapses all of it into one YAML flow: the JDBC trigger handles change detection, Parallel handles the fan out, plugin defaults centralize authentication, and every step's inputs, outputs, and logs are captured automatically. If any task fails you see exactly where, replay from that point, and keep the audit trail.
staging_data table (adapt the trigger SQL to your change detection strategy).my-data-lake-bucket) and a Databricks workspace with a job and SQL warehouse. Replace the placeholder jobId and httpPath with your real values.JDBC_CONNECTION_STRING, PG_USERNAME, PG_PASSWORD: Postgres connection used by the trigger.AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: credentials for the S3 upload.DATABRICKS_HOST, DATABRICKS_TOKEN: workspace URL and personal access token for all Databricks tasks.jobId, and SQL warehouse httpPath with your own values.staging_data, and watch the execution run end to end.io.kestra.plugin.slack.notifications.SlackIncomingWebhook instead of only logging it.staging_data so the trigger only sees new data.io.kestra.plugin.debezium.postgres.RealtimeTrigger for true change data capture.num_errors exceeds a threshold.