[SQLObject] mapping DB to legacy python objects
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Charles B. <li...@st...> - 2004-03-24 21:31:13
|
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. |