CopyIn CopyIn

yaml
type: "io.kestra.plugin.jdbc.postgresql.CopyIn"

Copy a PostgreSQL table or a query to a file

Moves data between PostgreSQL tables or query to a file

Examples

Load csv or tsv into a postgres table

yaml
id: "copy_in"
type: "io.kestra.plugin.jdbc.postgresql.CopyIn"
url: jdbc:postgresql://127.0.0.1:56982/
username: postgres
password: pg_passwd
format: CSV
from: {{ outputs.export.uri }}
table: my_destination_table
header: true
delimiter: "    "

Properties

from

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

Source file URI

url

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The jdbc url to connect to the database

columns

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

An optional list of columns to be copied

If no column list is specified, all columns of the table will be copied.

delimiter

  • Type: string
  • Dynamic:
  • Required:

Specifies the character that separates columns within each row (line) of the file

The default is a tab character in text format, a comma in CSV format. This must be a single one-byte character. This option is not allowed when using binary

encoding

  • Type: string
  • Dynamic:
  • Required:

Specifies that the file is encoded in the encoding_name

If this option is omitted, the current client encoding is used. See the Notes below for more details.

escape

  • Type: string
  • Dynamic:
  • Required:

Specifies the character that should appear before a data character that matches the QUOTE value.

The default is the same as the QUOTE value (so that the quoting character is doubled if it appears in the data). This must be a single one-byte character. This option is allowed only when using CSV format.

forceNotNull

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

Do not match the specified columns' values against the null string

In the default case where the null string is empty, this means that empty values will be read as zero-length strings rather than nulls, even when they are not quoted. This option is allowed only in COPY FROM, and only when using CSV format.

forceNull

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

Match the specified columns' values against the null string, even if it has been quoted, and if a match is found set the value to NULL

In the default case where the null string is empty, this converts a quoted empty string into NULL. This option is allowed only in COPY FROM, and only when using CSV format.

forceQuote

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

Forces quoting to be used for all non-NULL values in each specified column

NULL output is never quoted. If * is specified, non-NULL values will be quoted in all columns. This option is allowed only in COPY TO, and only when using CSV format.

format

  • Type: string
  • Dynamic:
  • Required:
  • Default: TEXT
  • Possible Values:
    • TEXT
    • CSV
    • BINARY

Selects the data format to be read or written

freeze

  • Type: boolean
  • Dynamic:
  • Required:

Requests copying the data with rows already frozen, just as they would be after running the VACUUM FREEZE command

This is intended as a performance option for initial data loading. Rows will be frozen only if the table being loaded has been created or truncated in the current subtransaction, there are no cursors open and there are no older snapshots held by this transaction. It is currently not possible to perform a COPY FREEZE on a partitioned table.

Note that all other sessions will immediately be able to see the data once it has been successfully loaded. This violates the normal rules of MVCC visibility and users specifying should be aware of the potential problems this might cause.

  • Type: boolean
  • Dynamic:
  • Required:

Specifies that the file contains a header line with the names of each column in the file

On output, the first line contains the column names from the table, and on input, the first line is ignored. This option is allowed only when using CSV.

nullString

  • Type: string
  • Dynamic:
  • Required:

Specifies the string that represents a null value

The default is \N (backslash-N) in text format, and an unquoted empty string in CSV format. You might prefer an empty string even in text format for cases where you don't want to distinguish nulls from empty strings. This option is not allowed when using binary format.

oids

  • Type: boolean
  • Dynamic:
  • Required:

Specifies copying the OID for each row

An error is raised if OIDS is specified for a table that does not have OIDs, or in the case of copying a query.

password

  • Type: string
  • Dynamic: ✔️
  • Required:

The database user's password

quote

  • Type: string
  • Dynamic:
  • Required:

Specifies the quoting character to be used when a data value is quoted.

The default is double-quote. This must be a single one-byte character. This option is allowed only when using CSV format.

ssl

  • Type: boolean
  • Dynamic:
  • Required:
  • Default: false

Is the connection ssl

sslCert

  • Type: string
  • Dynamic: ✔️
  • Required:

The ssl cert

Must be a PEM encoded certificate

sslKey

  • Type: string
  • Dynamic: ✔️
  • Required:

The ssl key

Must be a PEM encoded key

sslKeyPassword

  • Type: string
  • Dynamic: ✔️
  • Required:

The ssl key password

sslMode

  • Type: string
  • Dynamic:
  • Required:
  • Possible Values:
    • DISABLE
    • ALLOW
    • PREFER
    • REQUIRE
    • VERIFY_CA
    • VERIFY_FULL

The ssl mode

sslRootCert

  • Type: string
  • Dynamic: ✔️
  • Required:

The ssl root cert

Must be a PEM encoded certificate

table

  • Type: string
  • Dynamic: ✔️
  • Required:

The name (optionally schema-qualified) of an existing table.

username

  • Type: string
  • Dynamic: ✔️
  • Required:

The database user

Outputs

rowCount

  • Type: integer

The rows count from this COPY