From b8b51fe4379936fe142c875ea0f17da14a12c27d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 2 Aug 2007 05:42:49 +0000 Subject: - sessionmaker module is out, replaced with simple function in session.py - scoping/class instrumenting behavior of sessionmaker moved into new scoping module which implements scoped_session() (subject to potential name change) - SessionContext / assignmapper are deprecated, replaced with scoped_session() --- doc/build/content/datamapping.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc') diff --git a/doc/build/content/datamapping.txt b/doc/build/content/datamapping.txt index 6308c8d7b..37afa0fd5 100644 --- a/doc/build/content/datamapping.txt +++ b/doc/build/content/datamapping.txt @@ -108,6 +108,12 @@ We're now ready to start talking to the database. The ORM's "handle" to the dat >>> from sqlalchemy.orm import sessionmaker >>> Session = sessionmaker(bind=engine, autoflush=True, transactional=True) +If you don't have an `Engine` yet, but want to define `Session`, define it without `bind`, and set the `bind` parameter later: + + {python} + >>> Session = sessionmaker(autoflush=True, transactional=True) + >>> Session.configure(bind=engine) # once engine is available + This `Session` class will create new `Session` objects which are bound to our database and have some various transactional characteristics. Whenever you need to have a conversation with the database, you instantiate a `Session`: {python} -- cgit v1.2.1