summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/sqlsoup.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-01-21 20:41:52 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-01-21 20:41:52 +0000
commit196284c083fc26c5ea87229f9e956f6584d27cc5 (patch)
tree38bce6be3cb632ce77134f2e92ae4a29caedb9d9 /lib/sqlalchemy/ext/sqlsoup.py
parentbf6c88fe2340bd1e7c9d4b5c897b1fa0938ae2e4 (diff)
downloadsqlalchemy-196284c083fc26c5ea87229f9e956f6584d27cc5.tar.gz
- ensure correct session usage + tests
Diffstat (limited to 'lib/sqlalchemy/ext/sqlsoup.py')
-rw-r--r--lib/sqlalchemy/ext/sqlsoup.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/ext/sqlsoup.py b/lib/sqlalchemy/ext/sqlsoup.py
index b2790c56e..6b977102c 100644
--- a/lib/sqlalchemy/ext/sqlsoup.py
+++ b/lib/sqlalchemy/ext/sqlsoup.py
@@ -395,7 +395,7 @@ def _selectable_name(selectable):
x = x[1:]
return x
-def class_for_table(selectable, **mapper_kwargs):
+def class_for_table(session, selectable, **mapper_kwargs):
selectable = expression._clause_element_as_expr(selectable)
mapname = 'Mapped' + _selectable_name(selectable)
# Py2K
@@ -429,13 +429,13 @@ def class_for_table(selectable, **mapper_kwargs):
klass.c = expression.ColumnCollection()
mappr = mapper(klass,
selectable,
- extension=AutoAdd(Session),
+ extension=AutoAdd(session),
**mapper_kwargs)
for k in mappr.iterate_properties:
klass.c[k.key] = k.columns[0]
- klass._query = Session.query_property()
+ klass._query = session.query_property()
return klass
class SqlSoup(object):
@@ -502,7 +502,7 @@ class SqlSoup(object):
try:
t = self._cache[selectable]
except KeyError:
- t = class_for_table(selectable, **kwargs)
+ t = class_for_table(self.session, selectable, **kwargs)
self._cache[selectable] = t
return t
@@ -525,7 +525,7 @@ class SqlSoup(object):
if not table.primary_key.columns:
raise PKNotFoundError('table %r does not have a primary key defined [columns: %s]' % (attr, ','.join(table.c.keys())))
if table.columns:
- t = class_for_table(table)
+ t = class_for_table(self.session, table)
else:
t = None
self._cache[attr] = t