Re: [SQLObject] Another newbie question: copying objects?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Mark M. <mar...@me...> - 2011-03-09 17:34:33
|
What about the connection argument? Do I have to just add that to the dict? On Mar 9, 2011, at 2:43 AM, Oleg Broytman wrote: > On Tue, Mar 08, 2011 at 03:56:35PM -0800, Mark McWiggins wrote: >> Is there a way to do this without specifying all the field names? Right now I am just using two fields: >> >> zips = zipcode.select() >> >> for z in zips: >> newz = zipcode(id = z.id, city = z.city, connection = peconnection) >> >> This works, but where there are 14 fields in other tables it's going to be a pain. I couldn't find anything about >> object copy or assignment in the documents, but isn't there a way to do this? > > You can convert a row to a dict: z.sqlmeta.asDict() - and pass the > dict back: newz = zipcode(**z.sqlmeta.asDict()) > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss Mark McWiggins Principal Solutions Engineer mar...@me... 443-656-3311 ext 344 |