-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Milestone
Description
Migrated issue, originally created by Michael Bayer (@zzzeek)
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)
class B(Base):
__tablename__ = 'b'
id = Column(Integer, primary_key=True)
a_id = Column(ForeignKey('a.id'))
a = relationship(
"A",
# no UPDATE is emitted at the end unless this is
# commented out
post_update=True
)
e = create_engine("sqlite://", echo=True)
Base.metadata.create_all(e)
s = Session(e)
s.add(B(a=A()))
s.commit()
b1 = s.query(B).first()
b1.a = None
s.commit()
b1 = s.query(B).first()
assert b1.a is None
Reactions are currently unavailable