CSV, Fixed-Width, and DBF Files
A retry-wrapper on top of PostgreSQL's COPY protocol
For file-based sources, pgloader implements a retry policy
around the load: if a COPY transaction fails partway through, the
rejected rows are separated out and the accepted rows still make it
to PostgreSQL — instead of the whole batch failing on one bad row.
LOAD CSV
FROM 'data.csv' WITH ENCODING iso-646-us
HAVING FIELDS (id, name, created_at)
INTO postgresql:///dbname
TARGET TABLE public.records
WITH truncate, skip header = 1,
fields optionally enclosed by '"',
fields terminated by ','
DBF and fixed-width files work the same way — pgloader inspects
the file header automatically for DBF, and a column-position spec
for fixed-width text.