How should I import data from CSV into a Postgres table using pgAdmin 3?

PostgresqlPgadmin

Postgresql Problem Overview


Is there any plugin or library which I need to use for this? I want to try this on my local system first and then do the same on Heroku Postgresql

Postgresql Solutions


Solution 1 - Postgresql

pgAdmin has GUI for data import since 1.16. You have to create your table first and then you can import data easily - just right-click on the table name and click on Import.

enter image description here

enter image description here

Solution 2 - Postgresql

assuming you have a SQL table called mydata - you can load data from a csv file as follows:

COPY MYDATA FROM '<PATH>/MYDATA.CSV' CSV HEADER;

For more details refer to: http://www.postgresql.org/docs/9.2/static/sql-copy.html

Solution 3 - Postgresql

You may have a table called 'test'

COPY test(gid, "name", the_geom)
FROM '/home/data/sample.csv'
WITH DELIMITER ','
CSV HEADER

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionabhimView Question on Stackoverflow
Solution 1 - PostgresqlTomas GreifView Answer on Stackoverflow
Solution 2 - Postgresqluser1509107View Answer on Stackoverflow
Solution 3 - PostgresqlRajitha BandaraView Answer on Stackoverflow