9 messages in com.googlegroups.sqlalchemy[sqlalchemy] Beginner: query.join not...| From | Sent On | Attachments |
|---|---|---|
| bukzor | 24 Jun 2008 18:22 | |
| Kyle Schaffrick | 24 Jun 2008 23:51 | |
| bukzor | 25 Jun 2008 00:23 | |
| Kyle Schaffrick | 25 Jun 2008 01:43 | |
| bukzor | 25 Jun 2008 10:24 | |
| Michael Bayer | 25 Jun 2008 10:50 | |
| bukzor | 26 Jun 2008 08:12 | |
| Michael Bayer | 26 Jun 2008 08:28 | |
| bukzor | 26 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---




