models: User, Show, Episode

Show 1-----n Episode
User n------n Show

so: shows can have multiple episodes and different users can have
different shows


I want to construct a query that will:

- check if episode dates to specific date
- join all shows on that episode
- filter out shows that are not bound to specific user

the query that is not working correctly is:

            AShow = aliased(Show)
            q = s.query(Episode, AShow)\
                    .filter(Episode.airdate.between(date1, date2))\
                    .filter(User.userID == 2)\
                    .join(User.relShows)\
                    .join(AShow)

(User.relShows is the n-n relation to Shows that lists all shows which
one user posseses)

If I haven't explained myself enough, please say so. I have no idea
where I'm failing:)

--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to