diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-11-22 18:05:05 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-11-22 18:05:05 -0500 |
commit | 4de3b28abce67a09dfde1cffd8a244b6542ae8c1 (patch) | |
tree | a5ec8ef126ce6dc82eff4e8d9e7393ac80dcbb77 /lib/sqlalchemy/sql/compiler.py | |
parent | 90b6ca30e430a06ed1d1696f3881ae72c6014ecd (diff) | |
download | sqlalchemy-4de3b28abce67a09dfde1cffd8a244b6542ae8c1.tar.gz |
fixes to actually get tests to pass
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 24c3687e9..4b1b9bd5d 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1025,11 +1025,7 @@ class SQLCompiler(engine.Compiled): self.isupdate = True - if update_stmt._whereclause is not None: - extra_froms = set(update_stmt._whereclause._from_objects).\ - difference([update_stmt.table]) - else: - extra_froms = None + extra_froms = update_stmt._extra_froms colparams = self._get_colparams(update_stmt, extra_froms) @@ -1038,20 +1034,17 @@ class SQLCompiler(engine.Compiled): update_stmt.table, extra_froms, **kw) + text += ' SET ' if extra_froms and self.render_table_with_column_in_update_from: - text += ' SET ' + \ - ', '.join( + text += ', '.join( self.visit_column(c[0]) + - '=' + c[1] - for c in colparams - ) + '=' + c[1] for c in colparams + ) else: - text += ' SET ' + \ - ', '.join( + text += ', '.join( self.preparer.quote(c[0].name, c[0].quote) + - '=' + c[1] - for c in colparams - ) + '=' + c[1] for c in colparams + ) if update_stmt._returning: self.returning = update_stmt._returning @@ -1144,6 +1137,8 @@ class SQLCompiler(engine.Compiled): postfetch_lastrowid = need_pks and self.dialect.postfetch_lastrowid check_columns = {} + # special logic that only occurs for multi-table UPDATE + # statements if extra_tables and stmt.parameters: for t in extra_tables: for c in t.c: @@ -1186,7 +1181,7 @@ class SQLCompiler(engine.Compiled): ( implicit_returning or not postfetch_lastrowid or - c is not t._autoincrement_column + c is not stmt.table._autoincrement_column ): if implicit_returning: @@ -1213,7 +1208,7 @@ class SQLCompiler(engine.Compiled): self.returning.append(c) else: if c.default is not None or \ - c is t._autoincrement_column and ( + c is stmt.table._autoincrement_column and ( self.dialect.supports_sequences or self.dialect.preexecute_autoincrement_sequences ): |