On Mar 8, 2006, at 5:40 PM, Florian Boesch wrote:

My add_assoc function now looks like:

def add_assoc(name, own, other, on_table):
    table = own.mapper.tables[-1]
    other_table = other.mapper.tables[-1]
    primaryjoin = table.join(on_table).onclause
    secondaryjoin = other_table.join(on_table).onclause
relation = sqla.relation(other.mapper, on_table, primaryjoin=primaryjoin,
secondaryjoin=secondaryjoin, lazy=False)
    own.mapper.add_property(name, relation)

well I was about to tell you how that wouldnt work but I changed my mind and checked it in, since all three inheritance unit tests came from you originally and they all work using the above pattern. however, it *does* break if you are mapping against a select statement, such as the Zblog demo does, so I instead made whats usually "tables[-1]" available as "noninherited_table", or the main table that was specified to the mapper minus any inheritance adjustments. so go ahead and take your joins out of there.

I guess if someone wants a relation to go off of a table other than the childmost table in an inheriting mapper, *that* would be when they specify primary/secondary join.



Btw. I've got a really strange caching issue in conjunction with this.

To give you a picture. I've got content beeing the base of everything I build an url for. So this has a title. I derive page and from page I derive linklist. Linklist references pages. When I go to a specific linkist which gets its title from the content table, the title doesn't get updated when I change the content on the database. It's as if the base-class association isn't fetched but
cached.

cant give you much insight into that without specifics. but I would say, "echo=True" / "echo='debug'" is your friend.



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to