Re: Howto import regularly some CSV files with variing names?

Поиск
Список
Период
Сортировка
От Rowan Collins
Тема Re: Howto import regularly some CSV files with variing names?
Дата
Msg-id 5241E6C2.9090107@gmail.com
обсуждение исходный текст
Ответ на Re: Howto import regularly some CSV files with variing names?  (Rémi Cura <remi.cura@gmail.com>)
Список pgsql-general
On 24/09/2013 18:18, Rémi Cura wrote:
> To be very straightforward :
> your bash script will dynamically create the sql query in a string,
> then send it to database using psql.
> You can also use pipes.
>
> For example :
> $4 -c "COPY $1 FROM '/tmp/pipe_ply_binaire_vers_ply_ascii_"$1"' WITH
> CSV DELIMITER AS ' ';";
>
> where $4 is the psql command to connect to db, $1 the number in the
> name of the file we are working in, etc

One problem with this is that it requires your shell script to have
superuser access to your database, since it is directly running a COPY
command. This may or may not matter, depending on setup - for instance,
you might trust local Unix sockets, meaning someone would need access to
the box first. It's probably best to never have a non-interactive
process able to connect with elevated privileges though.

--
Rowan Collins
[IMSoP]


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

Предыдущее
От: Rémi Cura
Дата:
Сообщение: Re: Howto import regularly some CSV files with variing names?
Следующее
От: Rowan Collins
Дата:
Сообщение: Re: Howto import regularly some CSV files with variing names?