Issue 307: MemoryError on OS X accessing Decimal columns in SQL Server database
Status:  Investigating
Owner: ----
Reported by lacerc...@gmail.com, Jan 27, 2013
I'm using pyodbc 3.0.6, OS X 10.8, system iODBC, FreeTDS 0.91. Connecting to a SQL Server database, attempting to select a single row in a table that contains a column of type decimal(18,2), containing a NULL in this case. If that column (alone or together with other columns) is included in the query, cursor.fetchone() fails with a MemoryError; if the column is not included, it works.

The same issue occurs using the head branch from pyodbc's git.
Mar 28, 2013
Project Member #1 mkleehammer
(No comment was entered for this change.)
Status: Investigating
Labels: OpSys-OSX
Oct 9, 2013
#2 gsib...@gmail.com
I am also encountering this issue.
Nov 13, 2013
#3 pradyut2...@gmail.com
I am seeing this issue as well.
Mar 27, 2015
#5 mewa...@gmail.com
this ever get fixed?
Apr 6, 2015
#6 ne...@donuts.co
This is a problem in 3.0.7 and at this time there is no newer release. However, the latest source code fixes this problem. If you're using PIP you can install this like so:

sudo pip install 'git+https://github.com/mkleehammer/pyodbc'

The latest source is on GitHub and I've recreated  issue #35  to track it:

https://github.com/mkleehammer/pyodbc/issues/35

Finally, here is a query I used to test this problem:

SELECT CAST(NULL AS DECIMAL)

If you run this through Pyodbc 3.0.7 it raises a MemoryError exception but it works fine within FreeTDS directly (tested in the tsql command-line tool).