[sqlalchemy] Re: expire_on_commit and relationships

2015-09-17 Thread Hagai Cohen
back_populate solves this. Full Example: from sqlalchemy import create_engine, Column, ForeignKey, Integerfrom sqlalchemy.ext.declarative import declarative_basefrom sqlalchemy.orm import relationship, sessionmaker Base = declarative_base() ## Modelclass Parent(Base): __tablename__ =

[sqlalchemy] Re: expire_on_commit and relationships

2015-09-17 Thread Jonathan Vanasco
Immediately I notice that the attributes `father`/`mother` have no relationship to the `Parent` object. I think specifying backref/back_populates should solve your issue: http://docs.sqlalchemy.org/en/rel_1_0/orm/backref.html Also, FYI You can use `expire` on just the relationships