Re: Exporting Data

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: guilherme <guilherme(at)quirius(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Exporting Data
Date: 2013-06-20 18:54:35
Message-ID: 005E10E1-5231-4741-B02E-C1C06488AC25@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jun 20, 2013, at 14:33, guilherme <guilherme(at)quirius(dot)com(dot)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, I suggest 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shaun Thomas 2013-06-20 18:54:59 Re: PSA: If you are running Precise/12.04 upgrade your kernel.
Previous Message Jeff Janes 2013-06-20 18:42:45 Re: unexpected external sort Disk