-
Notifications
You must be signed in to change notification settings - Fork 562
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
cursor returns incorrect numerical value #45
Comments
What version of pyodbc? And are you using unixODBC? If so, did you compile it yourself with the default flags or did you change any? Due to driver bugs I read decimal columns as Unicode instead of a binary structure. My guess is that I'm reading it and the Unicode characters are wider than I expect. unixODBC always uses 2-byte UCS2, so I'll look at each character in 2-byte chunks. If the data is actually 4-byte, it is going to look like [ "2" NUL "0" NUL "2" NUL ... ]. So would stop at the first null terminator and end up with just "2". |
The error occurs through versions 3.0.2 - 3.0.10. I am using unixODBC. I think what you've described is happening. This is what I get in the logs:
Anything I can do to fix this? |
Are you still experiencing this with latest version of pyODBC? If so, please post an ODBC trace for more investigation. |
Is this issue resolved? I have latest version of PYODBC - 4.0.30. I am still getting the same issue when write data from SQL Server which having different datatypes into File? Instead of getting Date and Decimal as below writing the data into file as |
Unable to reproduce with (reasonably) current versions: Python version: 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0] crsr.execute("INSERT INTO m (day, string, volume) VALUES ('2015-04-30', 'blah', 2029139)")
print(crsr.execute("SELECT * FROM m").fetchone())
# (datetime.date(2015, 4, 30), 'blah', Decimal('2029139')) |
Running on
Connecting to PosgreSQL DB v 9.4 of form
Running isql using Postgres UNICODE driver returns correct values
Using pyodbc
outputs
The text was updated successfully, but these errors were encountered: