So I see how you can access the columns in one of your model objects. For
example ObjectQuery.user_name to get the user_name attribute from that
query object. But how do I use the relationships that I setup in my model
classes? I made a class definition where I join two tables(and it worked
fine, but seems wasteful if there's a better way), because I couldn't
figure out how to access the relation from the table below.
Example code of mine:
class Role(DeclarativeBase):
__tablename__ = 'roles'
__table_args__ = {}
#column definitions
role_name = Column(u'role_name', VARCHAR(length=45))
roles_id = Column(u'roles_id', INTEGER(), primary_key=True,
nullable=False)
#relation definitions
projects = relation('Project',
primaryjoin='Role.roles_id==ProjectRole.role_id', secondary=project_roles,
secondaryjoin='ProjectRole.project_id==Project.projects_id')
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.