Skip to content

additional M2O history only case raising occurs w/ delete #4997

Closed
@zzzeek

Description

@zzzeek
Member

this continues from #4353, the load is still raising for a delete:

from sqlalchemy import Column, ForeignKey, Integer, create_engine, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker

Base = declarative_base()

class Parent(Base):
    __tablename__ = 'parents'
    id = Column(Integer, primary_key=True)

class Child(Base):
    __tablename__ = 'children'
    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(Parent.id))
    parent = relationship(Parent, lazy='raise')
    data = Column(String)

engine = create_engine('sqlite:///:memory:', echo=True)
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()

# Add
parent = Parent()
session.add(parent)
session.flush()
child = Child(parent_id=parent.id)
session.add(child)
session.commit()
session.close()

child = session.query(Child).first()
#child.data = 'foo'
session.delete(child)
session.commit()

Activity

added this to the 1.3.xx milestone on Nov 22, 2019
sqla-tester

sqla-tester commented on Nov 22, 2019

@sqla-tester
Collaborator

Mike Bayer has proposed a fix for this issue in the master branch:

Don't raise w/ raiseload strategy for many-to-one history in flush https://gerrit.sqlalchemy.org/1586

sqla-tester

sqla-tester commented on Nov 22, 2019

@sqla-tester
Collaborator

Mike Bayer has proposed a fix for this issue in the rel_1_3 branch:

Don't raise w/ raiseload strategy for many-to-one history in flush https://gerrit.sqlalchemy.org/1587

added a commit that references this issue on Nov 22, 2019
2e6754a
modified the milestones: 1.3.xx, 1.3.x on Dec 18, 2019
added a commit that references this issue on Dec 29, 2019
511e8cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingorm

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @zzzeek@sqla-tester

        Issue actions

          additional M2O history only case raising occurs w/ delete · Issue #4997 · sqlalchemy/sqlalchemy