denisenkom / pytds

Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation
MIT License
192 stars 53 forks source link

Properly passing raw bytes to and from sql server when `bytes_to_unicode` is set to false #76

Closed VFLashM closed 7 years ago

VFLashM commented 7 years ago

Please see #73 for details.

I tried to pass bytes_to_unicode to serializers via constructor, but it proven to be much harder than I expected. bytes_to_unicode defaults to True for connections, but for some unit tests it defaults to False. I got dozens of errors at random places and couldn't fix it without modifying lots of tests.

Fixes #73

denisenkom commented 7 years ago

Tests are failing, please take a look

VFLashM commented 7 years ago
pytds.tds_base.OperationalError: Cannot open database "test" requested by the login. The login failed. Login failed for user 'sa'.

Looks like misconfiguration to me.

VFLashM commented 7 years ago

Ah, I see what's the problem. I forgot that test db is created on the fly by DbTestCase. Inheriting DbTestCase won't work in this case, but I can work around it by always connecting to master. Will commit fix tomorrow.

codecov[bot] commented 7 years ago

Codecov Report

Merging #76 into master will increase coverage by 0.04%. The diff coverage is 97.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #76      +/-   ##
==========================================
+ Coverage   86.93%   86.97%   +0.04%     
==========================================
  Files          22       22              
  Lines        7423     7455      +32     
==========================================
+ Hits         6453     6484      +31     
- Misses        970      971       +1
Impacted Files Coverage Δ
tests/all_test.py 96.84% <100%> (+0.05%) :arrow_up:
pytds/tds_types.py 92.79% <95.45%> (-0.01%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7ed0eac...10eace4. Read the comment docs.

denisenkom commented 7 years ago

Looks good, let me know if you need a release to pypi