Hi all,
I have a problem when querying the database:
This channel class:
class Channel(rdb.Model):
"""Represents both complex channels and trivial ones (media)"""
rdb.metadata(metadata)
rdb.tablename("channels")
id = Column("id", Integer, primary_key=True)
title = Column("title", String(100))
....
items = relationship("MediaItem", secondary=channel_items,
order_by="MediaItem.position", backref="channels")
I get the proper channel object if I do:
channel = session.query(Channel).filter(Channel.title == title)
And this is my mediaGroup class:
class MediaGroup(rdb.Model):
"""Represents MediaGroup class. Contains channels and other media
groups"""
rdb.metadata(metadata)
rdb.tablename("media_groups")
id = Column("id", Integer, primary_key=True)
title = Column("title", String(100))
....
channels = relationship("Channel", secondary=media_group_channels,
order_by="Channel.titleView", backref="media_groups")
mediaGroups = relationship("MediaGroup",
secondary=media_group_groups, order_by="MediaGroup.title",
primaryjoin=lambda: MediaGroup.id ==
media_group_groups.c.media_groupA_id,
secondaryjoin=lambda: MediaGroup.id ==
media_group_groups.c.media_groupB_id,
backref="media_groups")
I get the Query object object if I do:
mediaGroup = session.query(MediaGroup).filter(MediaGroup.title ==
title)
I don't know if it's because of the relationships but I tried without
mediaGroups relation, and I didn't work either.
Any idea??
Thanks!
--
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.