Re: [SQLObject] mapping DB to legacy python objects
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: David M. <da...@re...> - 2004-03-24 23:07:23
|
Something I'm doing that works is to not try to save the SQLOBject object in the persistables (doesn't really make sense to me to try to persist something which itself facilitates persistence), but only save whatever is required to reconstruct the SQLObject object - for instance, the database name, username and password, in the case of {My|Postgre}SQL backends. Yes, during each run cycle it's handy to have the odd SQLObject object ref lurking around within your persistables, but it's also easy to del those refs immediately prior to pickling, and reconstruct the SQLObject object and set it as an attribute in the persistables immediately after unpickling. Cheers David Charles Brandt wrote: > Hi, > > I'm in the process of trying to add persistence using SQLObject to some > python objects in an existing project. I'm hitting a snag since the object > has (private-ish) variables that begin with "__". When I try simply > creating corresponding columns in the database with SQLObject, ie: > __remote_address = STringCol(length=32) > __creation_time = DateTimeCol(default=SQLBuilder.func.NOW()) > > I get: > AssertionError: Name must be SQL-safe (letters, numbers, underscores): > '_StickySessions__remote_address' > > I was hoping to avoid renaming them, since that would mean over riding all > methods that access that data too. Seemed rather brittle, but is looking > like the best option at this point. > > I also tried to just create an alias pointing to the variable like this: > remote_address = STringCol(length=32) > __remote_address = remote_address > but that didn't work either. > > Any other ideas on how to deal with this scenario? Thanks in advance. > > -Charles. > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > -- Kind regards David -- leave this line intact so your email gets through my junk mail filter |