diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-01-28 23:49:22 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-01-28 23:49:22 +0000 |
commit | e78cee66186b8851a5018e32f6935ca72be0cf7e (patch) | |
tree | 9f014b0a33ad01270b972b2ae3eeb8212a5b9d49 /lib/sqlalchemy/engine/default.py | |
parent | 0b185fc84f32c153239fd42a219b5a3a8e56ebda (diff) | |
download | sqlalchemy-e78cee66186b8851a5018e32f6935ca72be0cf7e.tar.gz |
- the "autocommit" flag on select() and text() as well
as select().autocommit() are deprecated - now call
.execution_options(autocommit=True) on either of those
constructs, also available directly on Connection and orm.Query.
Diffstat (limited to 'lib/sqlalchemy/engine/default.py')
-rw-r--r-- | lib/sqlalchemy/engine/default.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index e168a5465..e2a03d227 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -229,7 +229,6 @@ class DefaultExecutionContext(base.ExecutionContext): self.dialect = dialect self._connection = self.root_connection = connection self.engine = connection.engine - self.execution_options = connection._execution_options if compiled_ddl is not None: self.compiled = compiled = compiled_ddl @@ -268,9 +267,6 @@ class DefaultExecutionContext(base.ExecutionContext): self.isinsert = compiled.isinsert self.isupdate = compiled.isupdate self.isdelete = compiled.isdelete - if compiled.statement._execution_options: - self.execution_options =\ - compiled.statement._execution_options.union(self.execution_options) if not parameters: self.compiled_parameters = [compiled.construct_params()] @@ -301,18 +297,24 @@ class DefaultExecutionContext(base.ExecutionContext): self.cursor = self.create_cursor() @util.memoized_property - def should_autocommit(self): + def execution_options(self): if self.compiled: - autocommit = self.compiled.statement._autocommit - if autocommit is expression.PARSE_AUTOCOMMIT: + return self.compiled.statement._execution_options.union( + self._connection._execution_options) + else: + return self._connection._execution_options + + @util.memoized_property + def should_autocommit(self): + autocommit = self.execution_options.get('autocommit', expression.PARSE_AUTOCOMMIT) + if autocommit is expression.PARSE_AUTOCOMMIT: + if self.statement: return self.should_autocommit_text(self.statement) else: - return autocommit - elif self.statement: - return self.should_autocommit_text(self.statement) + return False else: - return False + return autocommit @util.memoized_property def _is_explicit_returning(self): |