On Jul 15, 2013, at 11:06 AM, Ed Singleton <singleto...@gmail.com> wrote:

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

SQLAlchemy supports this for those backends which also do, SQL Server is 
included, you just wouldn't use the JOIN keyword, instead use an implicit join. 
 Example:

            addresses.update().
                values(email_address=users.c.name).
                where(users.c.id == addresses.c.user_id).
                where(users.c.name == '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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
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