bulk update adds the PK to the SET clause; no tests
Issue #3451
resolved
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)
-
reporter -
reporter - changed status to resolved
- add changelog for
#3451, with 09485d733131b667813f44eb0b6807b698668ee7 fixes#3451 - also add a bulk_insert_mappings test
→ <<cset 2497d559ddeb>>
-
reporter see also bcbfcca2360, 92ac4a9f88a5bfb1
- Log in to comment
see https://github.com/zzzeek/sqlalchemy/pull/181