- changed status to wontfix
Declarative Docs for Scoped Session are Incorrect
Issue #1010
resolved
It appears to me at least that the docs for using scoped session in the declarative docs is incorrect. I believe this:
engine = create_engine('postgres://scott:tiger@localhost/test')
Session = scoped_session(sessionmaker(transactional=True, autoflush=False, bind=engine))
Base = declarative_base()
should actually pass engine into the declarative_base or the metadata will not be bound:
engine = create_engine('postgres://scott:tiger@localhost/test')
Session = scoped_session(sessionmaker(transactional=True, autoflush=False, bind=engine))
Base = declarative_base(engine)
Comments (1)
-
repo owner - Log in to comment
the metadata doesn't need to be bound and its always misleading when we illustrate things that way, since people then assume this association is required. so we have to always talk about metadata binding to engine as an "optional" thing.