9 messages in com.googlegroups.sqlalchemy[sqlalchemy] Beginner: query.join not...
FromSent OnAttachments
bukzor24 Jun 2008 18:22 
Kyle Schaffrick24 Jun 2008 23:51 
bukzor25 Jun 2008 00:23 
Kyle Schaffrick25 Jun 2008 01:43 
bukzor25 Jun 2008 10:24 
Michael Bayer25 Jun 2008 10:50 
bukzor26 Jun 2008 08:12 
Michael Bayer26 Jun 2008 08:28 
bukzor26 Jun 2008 08:43 
Subject:[sqlalchemy] Beginner: query.join not cooperating
From:bukzor (work@gmail.com)
Date:06/24/2008 06:22:26 PM
List:com.googlegroups.sqlalchemy

The Query.join() documentations says: def join(self, prop, id=None, aliased=False, from_joinpoint=False) 'prop' may be one of: * a class-mapped attribute, i.e. Houses.rooms

What exactly counts as class-mapped? I've set up a ForeignKey in my Files table as well as a backref relation in my Projects table, but none of these work:

print session.query(File).join(Project).filter_by(project='mario', tapeout='sa11').one() print session.query(File).join(Project.files).filter_by(project='mario', tapeout='sa11').one() print session.query(File).join(Project.id).filter_by(project='mario', tapeout='sa11').one() print session.query(File).join(File.project).filter_by(project='mario', tapeout='sa11').one() print session.query(File).join(File.project_id).filter_by(project='mario', tapeout='sa11').one()

They all fail with: sqlalchemy.exceptions.InvalidRequestError: Mapper 'Mapper|File|files' has no property '<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x2a9a283650>'

It seems like .join(Project) should 'just work' after the information I put in the sytem, but I don't know much...

If there's some documentation that makes this clear, feel free to just link it. If you want more code, let me know what to copy/paste.

Thanks! --Buck