summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonathan Ellis <jbellis@gmail.com>2007-01-17 18:25:37 +0000
committerJonathan Ellis <jbellis@gmail.com>2007-01-17 18:25:37 +0000
commit3d22b16255c98cd760fdd55657c24b8c5e131ac1 (patch)
treec67ceecea5157a5a42473a72b91e9bcd6c862db9 /lib
parent35fcfbc083475d6d010dc8f69c759b7147c02a6d (diff)
downloadsqlalchemy-3d22b16255c98cd760fdd55657c24b8c5e131ac1.tar.gz
document "Accessing the Session"
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/ext/sqlsoup.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/sqlsoup.py b/lib/sqlalchemy/ext/sqlsoup.py
index d3081bc23..7b0a5759d 100644
--- a/lib/sqlalchemy/ext/sqlsoup.py
+++ b/lib/sqlalchemy/ext/sqlsoup.py
@@ -163,6 +163,21 @@ to disambiguate columns with their table name:
Advanced Use
============
+Accessing the Session
+---------------------
+
+SqlSoup uses a SessionContext to provide thread-local sessions. You can
+get a reference to the current one like this:
+
+ >>> from sqlalchemy.ext.sqlsoup import objectstore
+ >>> session = objectstore.current
+
+Now you have access to all the standard session-based SA features, such
+as transactions. (SqlSoup's flush() is normally transactionalized, but
+you can perform manual transaction management if you need a transaction
+to span multiple flushes.)
+
+
Mapping arbitrary Selectables
-----------------------------
@@ -336,7 +351,7 @@ def _selectable_name(selectable):
def class_for_table(selectable, **mapper_kwargs):
if not hasattr(selectable, '_selectable') \
or selectable._selectable() != selectable:
- raise 'class_for_table requires a selectable as its argument'
+ raise ArgumentError('class_for_table requires a selectable as its argument')
mapname = 'Mapped' + _selectable_name(selectable)
klass = TableClassType(mapname, (object,), {})
def __cmp__(self, o):