Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better handling for byte strings that don't represent ascii data #46

Closed
GoogleCodeExporter opened this issue Mar 15, 2015 · 1 comment
Closed

Comments

@GoogleCodeExporter
Copy link

I have a test:

test_sqlalchemy:TestSA.test_pickle_type

that fails currently.  When this column is created, it is created as a 
varchar(50) column.  There is a note and monkey patch in:

sqlalchemy.dialects.mssql.pymssql.MSDialect_pymssql.dbapi

referring to the fact that pymssql does not have a Binary method.  I am a 
little over my head on this one as to what we need to do to fix it.  

Original issue reported on code.google.com by rsyr...@gmail.com on 15 Apr 2011 at 9:42

@GoogleCodeExporter
Copy link
Author

I have a pymssql only tests now for this in test_types.py:TestTypes.test_image. 
 There is also a commit in [bea17389d31e] which fixes this problem from a 
technical standpoint.  It simply turns all type(str) values into a hex 
representation and sends that to MSSQL.  This seems to work well from a 
technical perspective.

However, the down-side is that it makes debugging difficult.  If someone is 
trying to debug a problem by watching SQL Server traces, they are only going to 
see the hex coming over.  Since character data will probably be the most common 
type(str) to be sent over, this seems unideal.

Therefore, in [5ba20a7b7d70] I made the quote function smarter so that anything 
that can be decoded as ascii will get put directly in the string.  Everything 
else gets hex encoded.

These changes are currently in my bb repo but I would appreciate a look over 
what I have done to make sure it looks good.

Original comment by rsyr...@gmail.com on 16 Apr 2011 at 5:37

  • Changed title: better handling for byte strings that don't represent ascii data
  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant