Thanks! Based on your suggestion, I tried the following:

The inner query goes like this:

>repetition_table_2 = repetition_table.alias()
>s_inner = select([repetition_table_2.c.card_key],
            (repetition_table_2.c.rep_number==5) & \
            (repetition_table_2.c.grade==2)).limit(10)
>print db_session.execute(s_inner).fetchall()

[(3,), (8,), (16,), (34,), (27,), (42,), (33,), (32,), (37,), (36,)]

Now for the outer query:

>s = select([repetition_table.c.grade],(repetition_table.c.rep_number==2) & 
>(repetition_table.c.card_key==s_inner) )
>print db_session.execute(s).fetchall()

[(0,)]

I seem to be missing 9 entries...

I also tried the following trivial outer query, which I suppose should
give me back the results of my inner query:

>s = 
>select([repetition_table.c.card_key],(repetition_table.c.card_key==s_inner) )
>print db_session.execute(s).fetchall()

[(3,), (3,), (3,), (3,), (3,), (3,), (3,), (3,)]

Obviously, I'm still missing something...

Peter


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to