[Sqlalchemy-tickets] Issue #3802: SQL expression in ORM update only look for ClauseElement, not __c
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2016-09-20 13:53:51
|
New issue 3802: SQL expression in ORM update only look for ClauseElement, not __clause_element__() https://bitbucket.org/zzzeek/sqlalchemy/issues/3802/sql-expression-in-orm-update-only-look-for Michael 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) not_pk = Column(Integer) e = create_engine("sqlite://", echo=True) Base.metadata.create_all(e) a1 = A(not_pk=1) s = Session(e) s.add(a1) s.commit() # works a1.not_pk = A.not_pk.__clause_element__() s.commit() # fails a1.not_pk = A.not_pk s.commit() ``` |