Re: Exporting Data - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Exporting Data
Date
Msg-id 005E10E1-5231-4741-B02E-C1C06488AC25@gmail.com
Whole thread Raw
In response to Exporting Data  (guilherme <guilherme@quirius.com.br>)
List pgsql-general
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.



pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: unexpected external sort Disk
Next
From: Shaun Thomas
Date:
Subject: Re: PSA: If you are running Precise/12.04 upgrade your kernel.