class A(Base):
    __tablename__ = 'a'
id = Column(Integer, primary_key=True)
data = Column(String)
a1 = A(data='foo')
assert a1 in Session()
How to automatically add a SQLAlchemy object to the session?