Re: [SQLObject] per-instance connection
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: John B. <bre...@mc...> - 2010-02-04 20:45:58
|
> On Wed, Feb 03, 2010 at 01:37:08PM -1000, John Bresnahan wrote: >> 2) at what point is an object associated with a DB connection? >> 3) is it at all possible to change the DB connection associated with a given object? > > Objects (SQLObject instances that correspond to rows in a table) are > seldom associated with a connection (though it is certainly possible). > SQLObject classes (that correspond to tables) are usually associated with > a connection; .setConnection() is a class method. > To associate an object with a connection you have to SELECT it via that > connection: > >> trans = sqlhub.processConnection.transaction() > > and now do > > xfer = XferTable.get(id, connection=trans) > or XferTable.select(condition, connection=trans). > Most SQLObject methods accept 'connection' parameter. Thanks much! Is there a way to change the connection associated with an object you have already acquired via select? |