bulk update adds the PK to the SET clause; no tests

Issue #3451 resolved
Mike Bayer repo owner created an issue
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)

Comments (3)

  1. Log in to comment