Re: [sqlalchemy] Deletion of object with relationship(lazy='raise')

2019-11-22 Thread Mike Bayer
I can confirm this is a bug as I've found precedent for this not having to raise, new issue is https://github.com/sqlalchemy/sqlalchemy/issues/4997 On Fri, Nov 22, 2019, at 9:24 AM, Mike Bayer wrote: > that said, I'm looking at this as a potential bug because it should be able > to leave this

Re: [sqlalchemy] Deletion of object with relationship(lazy='raise')

2019-11-22 Thread Mike Bayer
that said, I'm looking at this as a potential bug because it should be able to leave this attribute alone, not really sure how this should be handled. On Fri, Nov 22, 2019, at 9:21 AM, Mike Bayer wrote: > lazy="raise" on a many to one is problematic because a lot of many-to-one > operations

Re: [sqlalchemy] Deletion of object with relationship(lazy='raise')

2019-11-22 Thread Mike Bayer
lazy="raise" on a many to one is problematic because a lot of many-to-one operations involve pulling up the object from the identity map, and that's it. since people are usually only trying to guard against SQL being emitted, use the raise_on_sql option instead: parent = relationship(Parent,

[sqlalchemy] Deletion of object with relationship(lazy='raise')

2019-11-22 Thread Marat Sharafutdinov
from sqlalchemy import Column, ForeignKey, Integer, create_engine 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)