On Sun, Aug 12, 2007 at 09:15:32PM -0500, Christopher Singley wrote:
> On Saturday 11 August 2007 13:05, Oleg Broytmann wrote:
> >    Most SQLObject methods accept "connection" parameter. So you create two
> > connections and pass one or the other to an every method.
> 
> Could you perhaps provide a brief example, please?  This is something I'm 
> interested in trying, too.

from sqlobject import connectionForURI
from_connection = connectionForURI("sqlite:///home/work/data.db")
to_connection = connectionForURI("postgres:/database")

class MyTable(SQLObject):
   name= StringCol()

for row in MyTable.select(connection=from_connection):
   values = row.sqlmeta.asDict()
   new_row = MyTable(connection=to_connection, **values)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to