Teradata / py 2.7.3 / pyodbc 3.0.3 - invalid literal for decimal

519 views
Skip to first unread message

V N

unread,
Jun 21, 2012, 12:01:16 AM6/21/12
to pyo...@googlegroups.com
python 2.7.3 / pyodbc 3.0.3 / Teradata drivers 14.00.00.04

Teradata database has a table with column key whose data type is Decimal(38,0).

>>> cursor = cursor.execute("select * from tbl sample 2")
>>> for row in cursor:
...     print row

Windows output:

(Decimal('51525057561'), '34298', ..., ...)
(Decimal('65767376651'), 'alila', ..., ...)
...

Linux output:

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
  File "/usr/local/Python-2.7.3/lib/python2.7/decimal.py", line 548, in __new__
    "Invalid literal for Decimal: %r" % value)
  File "/usr/local/Python-2.7.3/lib/python2.7/decimal.py", line 3866, in _raise_error
    raise error(explanation)
decimal.InvalidOperation: Invalid literal for Decimal: u''
>>>

Any ideas for how this can be fixed on Linux (RHEL 5.3)?

V N

unread,
Aug 3, 2012, 8:21:56 AM8/3/12
to pyo...@googlegroups.com
The suggestion mentioned on this post worked for me -  http://code.google.com/p/pyodbc/issues/detail?can=1&q=teradata&id=146   (Comment 1 by textur...@gmail.com, Jan 6, 2011)

I have built an egg and attached to this message.  This has been tested on a RHEL 5.3 x64 machine and the above issue goes away.


pyodbc-3.0.3-py2.7-linux-x86_64.egg
Reply all
Reply to author
Forward
0 new messages