Got it:
query = session.query(Store.Store)
query = query.join('userGroups', 'users')
query = query.filter(User.User.id == int(userId))
print str(query.all())
From the examples inside the sqlalchemy egg
(http://prdownloads.sourceforge.net/sqlalchemy/SQLAlchemy-0.6.6.tar.gz?download)
In the
Cr*p!... 5 minutes after writing, I got it:
query = session.query(Store.Store).select_from(join(Store.Store,
UserGroup.UserGroup,
Store.Store.userGroups)).filter(UserGroup.UserGroup.id ==
int(userGroupId))
http://www.sqlalchemy.org/docs/orm/tutorial.html#querying-with-joins
Well... it may help
Hello everyone!
I am reopening that because now I want to go an step further... And
I'm having troubles.
Let's say I have an Store class that has a relationship pointing to
UserGroup that has a relationship pointing to Users.
I'm trying to create a method getStoresByUserId(parameterUserId)