5 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Advice on complicate...
FromSent OnAttachments
Barry Hart18 Oct 2007 06:07 
pbienst20 Oct 2007 03:55 
Barry Hart20 Oct 2007 07:50 
pbienst20 Oct 2007 08:23 
pbienst20 Oct 2007 09:14 
Subject:[sqlalchemy] Re: Advice on complicated (?) SQL query
From:pbienst (Pete@UGent.be)
Date:10/20/2007 09:14:21 AM
List:com.googlegroups.sqlalchemy

If you allow me some more questions, I can now retrieve info from the cards table using:

s = select([card_table.c.id],(card_table.c.key.in_(s_inner)) )

Similarly from the revision table

s = select([repetition_table.c.actual_interval_s], (repetition_table.c.rep_number==3) & (repetition_table.c.card_key.in_(s_inner)) )

However, I'd also like to get both information simulaneously, as the ordering in both queries seems different. I tried this:

j = card_table.join(repetition_table, repetition_table.c.card_key.in_(s_inner) & (repetition_table.c.rep_number==3)) s = select([card_table.c.id,repetition_table.c.actual_interval_s], from_obj=[j])

But this went Cartesian again...

A second minor point: is it possible to get select to return a list of scalars [1,2, ...], rather than a list of tuples [(1,),(2,..), ...]

Peter