Hi. I have a simple model that looks like this:
Base = declarative_base(metadata=metadata)

class Item(Base):
    __tablename__ = 'item'
    id = Column('id', Integer, primary_key=True)
    group = Column('group', Integer)

Groups have no useful information other than the items they contain,
so I don't have a group table and the group column is not a foreign
key. The group column exists just to group associated Items.

I have a query that starts like this:
i2 = Item.__table__.alias()  # Item.alias() doesn't work :(
session.query(Item).join(i2, i2.c.group == Item.c.group)...
, but it fails on the join saying:
<class 'sqlalchemy.exceptions.InvalidRequestError'>: Mapper
'Mapper|Item|item' has no property ''
Why does my mapper need a connection between Item and Item if I am
specifying in the join the condition to use? I'm not even sure how I
would specify that relation. How do I make this join work?
Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to