Обсуждение: Exporting Data

Поиск
Список
Период
Сортировка

Exporting Data

От
guilherme
Дата:
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.



--
View this message in context: http://postgresql.1045698.n5.nabble.com/Exporting-Data-tp5760108.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: Exporting Data

От
Alban Hertroys
Дата:
On Jun 20, 2013, at 14:33, guilherme <guilherme@quirius.com.br> 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?


That's a sufficiently unique requirement that there probably is no way to do that natively.

Using a scripting language is probably your best bet. If you're already familiar with some, pick one of those. If not,
Isuggest Python (with the psycopg2 postgresql driver). There's even a version for Windows if that's what you're using. 

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.