Re: Extending copy_expert

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Andrea Riciputi <andrea(dot)riciputi(at)gmail(dot)com>
Cc: "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: Extending copy_expert
Date: 2014-10-13 21:35:40
Message-ID: CA+mi_8Znj1x9dvR-4rWcxm6ccA+g+Nnu0+FdEc6wF96VW34cnQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg

On Mon, Oct 13, 2014 at 9:49 PM, Andrea Riciputi
<andrea(dot)riciputi(at)gmail(dot)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

In response to

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2014-10-13 22:52:34 Re: Extending copy_expert
Previous Message Andrea Riciputi 2014-10-13 20:49:15 Re: Extending copy_expert