Re: Importing a CSV file to a table on Postgres

Поиск
Список
Период
Сортировка
От Phillip Smith
Тема Re: Importing a CSV file to a table on Postgres
Дата
Msg-id 1178282609.4760.11.camel@fukawi2.homelinux.net
обсуждение исходный текст
Ответ на Re: Importing a CSV file to a table on Postgres  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Ответы Re: Importing a CSV file to a table on Postgres  ("Oliveiros Cristina" <oliveiros.cristina@gmail.com>)
Список pgsql-novice
I'm not familiar with PGAdmin, but with console you can use a way like
this to insert the contents of a CSV-file into a database table on a
remote host:

cat <file.csv> | ssh <host> "psql -U <user> <database> -c 'copy <table> from stdin;'"

You can do the same from pgAdmin, you just need to upload the file to the server first, then do something like:
    COPY table1 FROM '/tmp/file1.txt';

Remember to write the path as the SERVER will see it, not as the client sees it!

*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email.

Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments

В списке pgsql-novice по дате отправления:

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Importing a CSV file to a table on Postgres
Следующее
От: "Mario Peshev"
Дата:
Сообщение: Export SELECT statement as SQL queries in file