Is there any easy tool to load CSVs into PostgreSQL?
I know there’s the POSTGIS DBF loader tool but I was wondering if there’s any non-commercial or commercial add-on that allows one to easily load in a CSV.
Is there any easy tool to load CSVs into PostgreSQL? I know there’s the
Share
The
COPYcommand, built-in to PostgreSQL, does exactly what you want. It’s most useful when used in its\copyvariant viapsql.Check the documentation for your particular Pg version, as
COPYoptions vary. In future please mention your Pg version when posting. Assuming you’re on 9.1, then from apsqlclient cou could use:and possibly other options, as documented in the link above, depending on the details of your CSV dialect.
Note that the
\copycommand will not work from PgAdmin-III or other clients; it’s specific topsql. RegularCOPYworks from any client, but requires that the file be accessible by the database server‘spostgresprocess, so it’s much less convenient.You can also use
pg_bulkloador ETL tools like Talend and Pentaho if the job is huge or more complicated.