Problem with dbi, odbc module and Oracle 9.2 - suffixed "L" with number data type

dananrg at yahoo.com dananrg at yahoo.com
Thu Mar 2 05:01:11 EST 2006


I was messing around with the native ODBC module (I am using Python in
a Win32 environment), e.g:

import dbi, odbc

...and it seems to meet my needs. I'd rather use a module that comes
natively with Python if it works (don't care about performance in this
particular use case; just that it works).

The only issue I've had so far is retrieving data from Oracle when an
integer has been defined like:

       number(p)    [same thing as number(p,0) evidently]

This is from a database I didn't design and can't change. Evidently
there are new ways to declare integer data types in Oracle.

The problem is that the ODBC module suffixes an "L" to any integer
returned that
was defined as data type number(p). For example, an integer stored as:
56  will be returned as 56L. Actually, it now seems to be doing the
same thing, at least in some cases, for number data types declared as
number(p,s). What gives? Anyone know why this would happen?

Can't use mxODBC because it's a commercial product and can't use
cx_oracle at the moment because I am stuck with Python 2.1 (for ESRI
geoprocessing), and there is no cx_oracle for Python 2.1 (starts with
Python 2.2 and refuses to install for 2.1). I could install a later
version of Python independently, but I need to be able to do the
geoprocessing that 2.1 allows as well as ODBC calls to Oracle all in
the same script. This means dbi,odbc seems to be my only choice.

Thanks for the help so far y'all. As a former Perl devotee, I now
worship at the altar of Python.




More information about the Python-list mailing list