Re: Exporting Data

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Exporting Data
Дата
Msg-id 51C30917.2080701@gmail.com
обсуждение исходный текст
Ответ на Re: Exporting Data  (David Johnston <polobo@yahoo.com>)
Список pgsql-general
On 06/20/2013 06:06 AM, David Johnston wrote:
> guilherme wrote
>> I need to get some information in database and export it.
>>
>> Is there a way to make PostgreSQL to export one data line to a new file?
>> Like this:
>> 1 FIRST LINE --> line1.txt;
>> 2 SECOND LINE --> line2.txt;
>> 3 THIRD LINE --> line3.txt
>> ...
>> and so...
>>
>> I know that I can import all information into a unique file, but I need to
>> split that information into severel files.
>> I've already searched in everything and didn't find a solution.
>>
>> Can anybody help?
>>
>> Thanks in advance.
>
> I doubt it.  You should export to a single file then use another tool to
> perform the split.  What platform and you working on?  If its Linux using
> "psql | some_splitting_command" should be doable.
>
> I guess you put your query into a function and use procedural language
> functionality to do that but I'm not sure on the necessary syntax.
>
> There may be third-party ETL tools that fulfill this need as well.

One I recently ran across is Dataset:

https://github.com/pudo/dataset

Docs:

https://dataset.readthedocs.org/en/latest/

In particular freezefile:

https://dataset.readthedocs.org/en/latest/freezefile.html

"mode specifies whether the query output is to be combined into a single
file (list) or whether a file should be generated for each result row
(item)."

>
> David J.
>



--
Adrian Klaver
adrian.klaver@gmail.com


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

Предыдущее
От: Antonio Goméz Soto
Дата:
Сообщение: Do not understand high estimates of index scan vs seq scan
Следующее
От: Tim Kane
Дата:
Сообщение: Order by with column ordinal and collate - fails to parse