diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-12-08 03:09:18 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-12-08 03:09:18 +0000 |
commit | d39a15748948904d5d45a3a6ee798b8b799b9311 (patch) | |
tree | 47fd0f112e62b299cf917710f194f5fa6c2a4d94 /lib/sqlalchemy/orm/session.py | |
parent | 358bc9db1c86fc26d89ed726305a109af14e2572 (diff) | |
download | sqlalchemy-d39a15748948904d5d45a3a6ee798b8b799b9311.tar.gz |
- Session.execute() now locates table- and
mapper-specific binds based on a passed
in expression which is an insert()/update()/delete()
construct. [ticket:1054]
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index d3d02ef3f..f171622d4 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -554,13 +554,11 @@ class Session(object): self._mapper_flush_opts = {} if binds is not None: - for mapperortable, value in binds.iteritems(): - if isinstance(mapperortable, type): - mapperortable = _class_mapper(mapperortable).base_mapper - self.__binds[mapperortable] = value - if isinstance(mapperortable, Mapper): - for t in mapperortable._all_tables: - self.__binds[t] = value + for mapperortable, bind in binds.iteritems(): + if isinstance(mapperortable, (type, Mapper)): + self.bind_mapper(mapperortable, bind) + else: + self.bind_table(mapperortable, bind) if not self.autocommit: self.begin() @@ -839,7 +837,7 @@ class Session(object): "a binding.") c_mapper = mapper is not None and _class_to_mapper(mapper) or None - + # manually bound? if self.__binds: if c_mapper: @@ -848,7 +846,7 @@ class Session(object): elif c_mapper.mapped_table in self.__binds: return self.__binds[c_mapper.mapped_table] if clause is not None: - for t in sql_util.find_tables(clause): + for t in sql_util.find_tables(clause, include_crud=True): if t in self.__binds: return self.__binds[t] |