Re: [sqlalchemy] Re: Custom (more restrictive) primaryjoin and deletion cascades

2017-04-19 Thread mike bayer
On 04/19/2017 10:36 AM, Adrian wrote: Here's a MVCE-style example showing the problem I have: | fromsqlalchemy import* fromsqlalchemy.ext.declarative importdeclarative_base fromsqlalchemy.orm import* Base=declarative_base() classType(Base): __tablename__ ='types' id

[sqlalchemy] Re: Custom (more restrictive) primaryjoin and deletion cascades

2017-04-19 Thread Adrian
Here's a MVCE-style example showing the problem I have: from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import * Base = declarative_base() class Type(Base): __tablename__ = 'types' id = Column(Integer, primary_key=True) def

Re: [sqlalchemy] Custom (more restrictive) primaryjoin and deletion cascades

2017-04-19 Thread mike bayer
Here's an MCVE. Works fine as long as "Abstract.is_deleted" is in fact False. if it's true, then it won't mark it, because it's not in the collection to be updated. from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base =

Re: [sqlalchemy] Custom (more restrictive) primaryjoin and deletion cascades

2017-04-19 Thread mike bayer
On 04/19/2017 07:27 AM, Adrian wrote: I have this relationship which adds a `ContributionType.proposed_abstracts` backref that contains only abstracts not flagged as deleted. contrib_type = relationship( 'ContributionType', lazy=True, foreign_keys=contrib_type_id,

Re: [sqlalchemy] Idle in transaction connections can not be returned to pool

2017-04-19 Thread mike bayer
On 04/18/2017 10:19 PM, JinRong Cai wrote: Hi: SQLA is used in my python project. And in my code, I have the green thread used. And the green thread was killed in some of my code. After the the thread was killed, and the transaction was just began. And the database connection was still in

[sqlalchemy] Custom (more restrictive) primaryjoin and deletion cascades

2017-04-19 Thread Adrian
I have this relationship which adds a `ContributionType.proposed_abstracts` backref that contains only abstracts not flagged as deleted. contrib_type = relationship( 'ContributionType', lazy=True, foreign_keys=contrib_type_id, backref=backref('proposed_abstracts',