| Issue 42: | cursor.description type_code inconsistency | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Environment:
* SQL Server 2008
* pyodbc version 2.1.3 (python 2.6)
What steps will reproduce the problem?
1. create a databse table with 2 columns:
* col1 decimal(24,12)
* col2 float(24)
2. insert one row with values (5.1, 5.1)
3. using pyodbc, run sql "SELECT * FROM TEST_TABLE", and get
cursor.description, which contains:
('col1', <type 'float'>, None, 24, None, None, True)
('col2', <type 'float'>, None, 24, None, None, True)
4. the data retrieved is:
(Decimal('5.100000000000'), 5.0999999046325684)
I expect the type for 'col1' to be decimal, not float.
So data is of correct type, but the cursor.description provides incorrect
information.
Or is there a way to get information about the python type that will be used?
Apr 1, 2009
Project Member
#1
mkleehammer
Status:
Investigating
Apr 17, 2009
Any idea when you could find time to fix it? I would like to automatically generate UI based on type information, and this issue messes things up. Thanks
Apr 17, 2009
Sorry for the delay -- its been a hectic year. How about this weekend?
Apr 17, 2009
Would be much appreciated, Thanks.
Apr 19, 2009
Fixed in 5b611be267c924d71493666f512d4c4161f8c30f, which will be in 2.1.5, to be released today. Updated the SQL Server test_small_decimal unit test to catch this.
Status:
Verified
Nov 21, 2010
(No comment was entered for this change.)
Status:
Complete
|