[Sqlalchemy-tickets] Issue #3451: bulk update adds the PK to the SET clause; no tests (zzzeek/sqlal
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2015-06-14 00:07:55
|
New issue 3451: bulk update adds the PK to the SET clause; no tests https://bitbucket.org/zzzeek/sqlalchemy/issue/3451/bulk-update-adds-the-pk-to-the-set-clause Mike Bayer: ``` #!python from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class A(Base): __tablename__ = 'a' id = Column(Integer, primary_key=True) data = Column(String) e = create_engine("sqlite://", echo=True) Base.metadata.create_all(e) s = Session(e) s.add(A(id=1, data='foo')) s.commit() s.bulk_update_mappings( A, [{'id': 1, 'data': 'bar'}] ) ``` the UPDATE statement is: ``` #! UPDATE a SET id=?, data=? WHERE a.id = ? (1, 'bar', 1) ``` |