views:

93

answers:

2

I am connecting to an MS SQL Server db from Python in Linux. I am connecting via pyodbc using the FreeTDS driver. When I return a money field from MSSQL it comes through as a float, rather than a Python Decimal.

The problem is with FreeTDS. If I run the exact same Python code from Windows (where I do not need to use FreeTDS), pyodbc returns a Python Decimal.

How can I get back a Python Decimal when I'm running the code in Linux?

+1  A: 

You could always just convert it to Decimal when it comes back...

Wayne Werner
That ends up being a lot of conversions and isn't exactly DRY. I agree that is the fall-back plan, but I'd really like to avoid that.
mwolfe02
A: 

It was a bug in FreeTDS. The bug has been fixed in the CVS head of FreeTDS as of August 4, 2010 (thanks Freddy Ziglio). See my post on the web2py message board for more info.

mwolfe02