summaryrefslogtreecommitdiff
path: root/doc/build
diff options
context:
space:
mode:
Diffstat (limited to 'doc/build')
-rw-r--r--doc/build/content/datamapping.txt6
1 files changed, 6 insertions, 0 deletions
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}