Hi, I'm facing to a strange behavior with bulk update on inherited class.
These two queries work differently : from sqlalchemy import Column, Integer, String, ForeignKey, create_engine from sqlalchemy.orm import relationship, Session from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Person(Base): __tablename__ = 'person' id = Column(Integer, primary_key=True) name = Column(String(50)) type = Column(String(50)) __mapper_args__ = { 'polymorphic_identity':'person', 'polymorphic_on':type } class Engineer(Person): __tablename__ = 'engineer' id = Column(Integer, ForeignKey('person.id'), primary_key=True) status = Column(String(30)) __mapper_args__ = { 'polymorphic_identity':'engineer', } #engine = create_engine('sqlite://', echo=True) engine = create_engine("mysql://*****/testing", echo=True) Base.metadata.create_all(engine) if __name__ == '__main__': session = Session(engine) engineer = Engineer(name='me', status='working') # populates session.add(engineer) session.commit() # raise : Unconsumed column names: name try: session.query(Engineer).filter(Engineer.name=='bar').update({'name': 'baz'}) session.commit() except Exception as err: print(err) # with MySQL engine , produce : 'UPDATE engineer, person SET person.name=%s WHERE person.name = %s' # with SQLite engine, produce : 'UPDATE engineer SET name=? FROM person WHERE person.name = ?' [Syntax Error] try: session.query(Engineer).filter(Engineer.status=='working').update({ 'name': 'bar'}) session.commit() except Exception as err: print(err) The former query fails, presumably because sqlalchemy don't care with the parent class. The later is handled correctly with MySQL (maybe because the fillter involve Person), but no with SQLite. (I also tried with_polymorphic, but it doesn't solve the problem). Is this a bug ? Best regards, yoch -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.