Commits

Marc Abramowitz committed 505133c

dialects/mssql/pymssql.py: Modify module.Binary to work properly with
byte strings in Python 3

Fixes http://www.sqlalchemy.org/trac/ticket/2683

Comments (0)

Files changed (1)

lib/sqlalchemy/dialects/mssql/pymssql.py

         module = __import__('pymssql')
         # pymmsql doesn't have a Binary method.  we use string
         # TODO: monkeypatching here is less than ideal
-        module.Binary = str
+        module.Binary = lambda x: x if hasattr(x, 'decode') else str(x)
 
         client_ver = tuple(int(x) for x in module.__version__.split("."))
         if client_ver < (1, ):