I'd like to be able to map read-only attributes based on a join, but
without mapping the class to a joined table.
----
Given this structure:
class unit:
pass
class recsite:
pass
units = Table('units',metadata,
Column('unit_id',Integer,
primary_key=True,nullable=False),
Column('recsite_id',Integer,
ForeignKey(recsites.c.recsite_id),
nullable=False))
recsites = Table('recsites',metadata,
Column('recsite_id',Integer,
primary_key=True,nullable=False),
Column('depth',Integer,nullable=False))
mapper(unit,units)
mapper(recsite,recsites)
----
Is there a way to map a 'depth' property for unit, without mapping
unit to units.join(recsites)? I tried adding a ColumnProperty to the
mapper, but while it succeeds, it returns the wrong value:
mapper(unit,units,
properties={'depth':ColumnProperty(recsites.c.depth)})
I can't find anything in the documentation for ColumnProperty that
tells me how to specify the join condition.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---