Re: Extending copy_expert - Mailing list psycopg

From Daniele Varrazzo
Subject Re: Extending copy_expert
Date
Msg-id CA+mi_8Znj1x9dvR-4rWcxm6ccA+g+Nnu0+FdEc6wF96VW34cnQ@mail.gmail.com
Whole thread Raw
In response to Re: Extending copy_expert  (Andrea Riciputi <andrea.riciputi@gmail.com>)
List psycopg
On Mon, Oct 13, 2014 at 9:49 PM, Andrea Riciputi
<andrea.riciputi@gmail.com> wrote:
> In my opinion it’d be better to push such a feature upstream to PG, but even having it in psycopg could be a good
compromise.Do you have any strong argument against such a feature in psycopg? Do you think it’d be better part of PG
itself?If so, how do you think I can gain support in the pgsql-hackers ml? 

Psycopg doesn't do much here: it receives buffers via PQgetCopyData
[1] and forwards them to the Python file in argument. You could easily
hack the function and replace the \n into \r\n in C, but this would
still imply a copy so I'm not sure it would be more efficient than
running copy from psql to stdout and piping the result througn sed
's/$/\r/', leaving Python entirely out of the equation.

[1] http://www.postgresql.org/docs/9.3/static/libpq-copy.html#LIBPQ-PQGETCOPYDATA

-- Daniele


psycopg by date:

Previous
From: Andrea Riciputi
Date:
Subject: Re: Extending copy_expert
Next
From: Adrian Klaver
Date:
Subject: Re: Extending copy_expert