The following code give an error about an ambiguous column on the order_by. This can easily be fixed by changing the order by column to 'anything.code' but I would assume that since the query will return objects of type Anything then it would assume anything.code
-------------------------------- from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Something(Base): __tablename__ = 'something' __mapper_args__ = {'order_by': 'code'} id = Column(Integer, primary_key=True) code = Column(String) class Anything(Base): __tablename__ = 'anything' __mapper_args__ = {'order_by': 'code'} id = Column(Integer, primary_key=True) code = Column(String) something_id = Column(Integer, ForeignKey('something.id')) somethings = relation(Something) uri = 'sqlite:///:memory:' engine = create_engine(uri) engine.connect() metadata = Base.metadata metadata.bind = engine -------------------------------------------- metadata.create_all() Session = sessionmaker(bind=engine) session = Session() session.query(Anything).join('somethings').all() --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---