summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/databases')
-rw-r--r--lib/sqlalchemy/databases/mssql.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index 9e00f2caa..5faaf31bf 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -709,6 +709,15 @@ class MSSQLDialect_pymssql(MSSQLDialect):
class MSSQLDialect_pyodbc(MSSQLDialect):
+ def __init__(self, **params):
+ super(MSSQLDialect_pyodbc, self).__init__(**params)
+ # whether use_scope_identity will work depends on the version of pyodbc
+ try:
+ import pyodbc
+ self.use_scope_identity = hasattr(pyodbc.Cursor, 'nextset')
+ except:
+ pass
+
def import_dbapi(cls):
import pyodbc as module
return module