On Oct 28, 2007, at 4:32 PM, Brian Beck wrote:

> Pretend the Select is more complicated and needs to reference both IDs
> (which may have come from subqueries) -- in this case any mapper
> features (like synonym) don't help, the Select needs to exist first!

the select can reference whatever columns it wishes in its WHERE  
clause, ORDER BY clause, whereever, *without* them being in the  
columns clause...your columns clause need not reference any columns  
whatsoever and it can still locate the correct rows.   so you should  
be putting only unique columns in the columns clause of your  
SELECT.    or, if youd like to tell your mapper about both columns  
being the same, set up the mapping like this:

ab_mapper = mapper(AB, s, properties={
     'id':[s.c.a_id, s.c.the_id_of_a]
})

then the class has a single 'id' attribute mapped to both columns.


>
> Isn't it an error that b_id trips off a refresh?  The correct values
> are inserted and should be available in last_inserted_ids for the
> mapper to populate instance with...

this is a slight issue in that its seeing the inline SQL as a  
postfetch trigger when its not, so that is fixed in r3679.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to