Re: Proposal: Adding "push" semantics to copy_from

Manlio Perillo <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Chris Cogdon ha scritto:
> Hi folks!
> 
> I'd like to get a new extension put into psycopg2 to allow "push"  
> semantics to "copy from" operations. Ie, rather than having  
> "copy_from" be passed a file handle ("pull" semantics), it returns a  
> object where I can generate my own data and "push" it into the  
> connection to the database (with flushing and closing operations, too).
> 
> If someone want's to go ahead and just do that, that's be totally  
> fantastic! In lieu of such unbounded generosity, I'd like to do the  
> work myself and offer it as a submission to psycopg2. So, if someone  
> has submission tips before I start work on that, I'd be grateful
> 

Some time ago I have written a PostgreSQL client implementation in Twisted:
http://hg.mperillo.ath.cx/twisted/pglib/

Actually the data to be copied to the server is handled using a "pull" 
semantic (data is read from an user supplied object every reactor cycle).

However this can be changed by allowing the user supplied object to 
return a deferred; the semantic is still "pull", but the user has more 
control on when to send the data.


 > [...]


Manlio Perillo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.