Re: Extending copy_expert

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: Extending copy_expert
Date: 2014-10-12 21:51:43
Message-ID: alpine.LNX.2.11.1410121449020.25325@localhost
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg

On Sun, 12 Oct 2014, Andrea Riciputi wrote:

> However the target software for which the file is produced, is, let say,
> “legacy” software and can only accept CRLF as EOL character. However by
> calling COPY TO STDOUT from psycopg ends up in a CSV file with LF as EOL
> forcing us to pass the file a second time to convert EOL, which is
> inconvenient. Plus, doing it in Python, make it a little bit to slow.

Andrea,

How about using unix2dos or todos? These linux utilities translate line
endings. When I get client data in text form with the CR/LF ends I translate
them to LF (\n) with fromdos (or the older flavor called dos2unix). It's
quick, but I've not tried them on a 500G file.

HTH,

Rich

In response to

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2014-10-13 00:18:11 Re: Extending copy_expert
Previous Message Andrea Riciputi 2014-10-12 21:28:54 Extending copy_expert