1. Hajime Nakagami
  2. sqlalchemy

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

  • Participants
  • Parent commits 5282871
  • Branches trac_ticket_2683

Comments (0)

Files changed (1)

File lib/sqlalchemy/dialects/mssql/pymssql.py

View file
         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, ):