I have two tables in SQLAlchemy which are identical and I want to update one 
from the other where the rows have the same primary key, and I want to do it in 
an efficient way.

I tried joining the tables on the primary key, but SQLAlchemy doesn't appear to 
support updates on joined tables at the moment (except using a subquery for 
every column, which was too inefficient).

I'd be keen to hear any suggestions of a good way to do this in a way that is 
portable across different backends.

Currently we have some raw sql (for MS SQL) that generates something like the 
following:

update [dbo].[table_1] set col_1 = table_2.col_1 , col_2 = table_2.col_2 from 
[dbo].[table_1] inner join table_2 on ([dbo].[table_1].id_1 = table_2.id_1 and 
[dbo].[table_1].id_2 = table_2.id_2)

Many thanks

Ed

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to