summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-02-13 11:26:54 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-02-13 11:26:54 -0500
commit71d642711d26ee8e1e7e8b19d70be8be1eca22eb (patch)
treeedaf76ca61a1cd35ee365cf99ddd3fd745358877 /lib/sqlalchemy/dialects
parent5cc5234e0b065907deb2765249dde1c526fe5c89 (diff)
downloadsqlalchemy-71d642711d26ee8e1e7e8b19d70be8be1eca22eb.tar.gz
Set IDENTITY_INSERT for insert.values({column: expr})
Fixed bug where the SQL Server "IDENTITY_INSERT" logic that allows an INSERT to proceed with an explicit value on an IDENTITY column was not detecting the case where :meth:`.Insert.values` were used with a dictionary that contained a :class:`.Column` as key and a SQL expression as a value. Fixes: #4499 Change-Id: Ia61cd6524b030b40a665db9c20771f0c5aa5fcd7
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py
index 93dc9d88a..494101140 100644
--- a/lib/sqlalchemy/dialects/mssql/base.py
+++ b/lib/sqlalchemy/dialects/mssql/base.py
@@ -1380,13 +1380,21 @@ class MSExecutionContext(default.DefaultExecutionContext):
and (
(
self.compiled.statement._has_multi_parameters
- and seq_column.key
- in self.compiled.statement.parameters[0]
+ and (
+ seq_column.key
+ in self.compiled.statement.parameters[0]
+ or seq_column
+ in self.compiled.statement.parameters[0]
+ )
)
or (
not self.compiled.statement._has_multi_parameters
- and seq_column.key
- in self.compiled.statement.parameters
+ and (
+ seq_column.key
+ in self.compiled.statement.parameters
+ or seq_column
+ in self.compiled.statement.parameters
+ )
)
)
)