diff options
| author | Gord Thompson <gord@gordthompson.com> | 2020-12-08 15:23:02 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-12-09 09:35:52 -0500 |
| commit | fdf06c9dcf241d863d252532b801a1281f2626de (patch) | |
| tree | 4cd905b10428f433a9b215cd52897a527638c0b7 /lib/sqlalchemy/dialects/mssql | |
| parent | c5831b1abd98c46ef7eab7ee82ead18756aea112 (diff) | |
| download | sqlalchemy-fdf06c9dcf241d863d252532b801a1281f2626de.tar.gz | |
Fixed compile for mssql dialect
Fixed string compilation when both mssql_include and mssql_where are used
Fixes: #5751
Closes: #5752
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5752
Pull-request-sha: aa57ad5d93cd69bf7728d864569c31c7e59b54fb
Change-Id: I1201170affd9911c252df5c9b841e538bb577085
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql')
| -rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 9addbf31f..911e1791a 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -2286,18 +2286,6 @@ class MSDDLCompiler(compiler.DDLCompiler): ), ) - whereclause = index.dialect_options["mssql"]["where"] - - if whereclause is not None: - whereclause = coercions.expect( - roles.DDLExpressionRole, whereclause - ) - - where_compiled = self.sql_compiler.process( - whereclause, include_table=False, literal_binds=True - ) - text += " WHERE " + where_compiled - # handle other included columns if index.dialect_options["mssql"]["include"]: inclusions = [ @@ -2311,6 +2299,18 @@ class MSDDLCompiler(compiler.DDLCompiler): [preparer.quote(c.name) for c in inclusions] ) + whereclause = index.dialect_options["mssql"]["where"] + + if whereclause is not None: + whereclause = coercions.expect( + roles.DDLExpressionRole, whereclause + ) + + where_compiled = self.sql_compiler.process( + whereclause, include_table=False, literal_binds=True + ) + text += " WHERE " + where_compiled + return text def visit_drop_index(self, drop): |
