When I first read the SA documentation I got the impression I could do this:

class Entity(object):
    def _get_attr(self):
        # get logic
    def _set_attr(self):
        # set logic
    attr = property(_get_attr, _set_attr)

entities = Table("entities",
    Column("id", ...),
    Column("attr", ...)
)

m = Mapper(Entity, entities)


I got the impression that SQLAlchemy would transparently wrap access to Entity.attr to track history, etc. However, I was rudely awakened when I realized that such code was not working...my "Entity.attr" property is simply overwritten by AttributeManager.register_attribute (...), which puts a SmartProperty there instead.

Am I overlooking something? Is there a way to do this? Could AttributManager and/or SmartProperty be improved to support properties as well as normal attributes?

~ Daniel


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to