Thanks for the response Mike... comments below.

On Oct 28, 12:52 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Oct 27, 2007, at 8:33 PM, Brian Beck wrote:
> without trying it yet the first thing that seems wrong is that your
> select has no join condition between a_table and b_table (nor are you
> using a join(), which would figure it out for you based on foreign
> keys, so your foreign key doesn't impact the equation much here on
> the select side).  the select will return the cartesian product
> between a and b which is definitely not what you want.

Doesn't matter -- same thing happens with or without the join
condition. (The cartesian product was intentional.)

> the actual error seems that the b_id column is tripping off a refresh
> of the instance's row, but when it issues your select(), its still
> not getting back what it wants.  since the mapper seems confused by
> the primary key of the select (which is likely because you have a_id
> represented twice), you might want to look into setting up your
> 'the_id_of_a' property at the mapper level as a synonym() or
> column_property() attribute. I dont see what good it does embedded
> into that select().  or, try explicitly setting the mapper's
> primary_key attribute to the desired columns from your select().

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!

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...


--~--~---------~--~----~------------~-------~--~----~
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