Blueprints

Export output of a Postgres SQL query to a CSV file

Source

yaml
id: export-from-postgres
namespace: company.team

tasks:
  - id: export
    type: io.kestra.plugin.jdbc.postgresql.CopyOut
    url: jdbc:postgresql://sample_postgres:5433/world
    username: postgres
    password: postgres
    format: CSV
    header: true
    sql: SELECT * FROM country LIMIT 10
    delimiter: ","

  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ outputs.export.rowCount }}"

About this blueprint

Postgres SQL Outputs

This example shows how to extract data from a Postgres table. The flow logs the number of extracted rows. The extracted file can be retrieved with the {{ outputs.export.uri }} command.

Copy Out

Log

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra