Skip to Content.
Sympa Menu

freetds - Re: [freetds] pyodbc returns MS SQL Server money type as float

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] pyodbc returns MS SQL Server money type as float
  • Date: Mon, 2 Aug 2010 11:22:33 +0200

2010/7/30 Michael Wolfe <michael.joseph.wolfe AT gmail.com>:
> I'm connecting to a SQL Server 2000 database via pyodbc and FreeTDS.
> I am running a query that returns the sum of a money column.  The
> result is being returned by pyodbc as a float, not a python Decimal.
>
> When I run the exact same python code and query against the exact same
> MSSQL database from Windows (ie, not using FreeTDS), pyodbc returns a
> python Decimal.
>
> There are obviously many differences between the two operating system
> environments, but I believe the central issue is with FreeTDS.  It is
> entirely possible that I have not configured things quite right.
>
> I am curious if this is a known limitation of FreeTDS or if I have
> just failed to configure something properly.
>
> Please note my comfort zone is with Windows and VBA, not Linux and
> python....so be gentle.
>
> Thanks in advance for any insights.
>
> -Mike

It could depend also on DM. FreeTDS ODBC support bigints but perhaps
some mix between FreeTDS/DM/pyodbc make python believe is better to
use a float. It would be helpful to have traces in Windows and in
Linux. I don't know which DM you have under Linux, I use unixODBC and
in my /etc/odbcinst.ini I have these lines.

[ODBC]
Trace = Yes
TraceFile = /tmp/sql.log
ForceTrace = Yes

(obviously is better to disable tracing in production).

Regards
Frediano Ziglio




Archive powered by MHonArc 2.6.24.

Top of Page