Skip to content

Load delimited files with unquoted strings that contain escaped delimiters #640

@pmatseykanets

Description

@pmatseykanets

Given a delimited file in the following format

  • fields delimited by a pipe char |
  • text fields are unquoted
  • some text field values contain an escaped pipe \|, an escaped line feed \\n or escaped carriage return \\r
1|text containing the pipe \| character|3
                           ^^^

what the correct combination of pgloader options might be to successfully load this file?

I tried

pgloader --type csv --field "field1,field2,field3" \
--with "fields terminated by '|'" \
--with "fields not enclosed" \
path/to/file.csv \
postgresql://user@host:port/dbname?tablename=schema.table

Which obviously didn't work for me as pgloader sees four fields instead of three.

Any insights would be highly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions