Issue 42: cursor.description type_code inconsistency
Status:  Complete
Owner: ----
Closed:  Apr 2009
Reported by ivan.mel...@gmail.com, Apr 1, 2009
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
Cursor.description is the way to get the information you want.  That's a bug...

Status: Investigating
Apr 17, 2009
#2 ivan.mel...@gmail.com
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
Project Member #3 mkleehammer
Sorry for the delay -- its been a hectic year.  How about this weekend?
Apr 17, 2009
#4 ivan.mel...@gmail.com
Would be much appreciated, Thanks.
Apr 19, 2009
Project Member #5 mkleehammer
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
Project Member #6 mkleehammer
(No comment was entered for this change.)
Status: Complete