Best python module for Oracle, but portable to other RDBMSes

Magnus Lycka lycka at
Thu Mar 2 04:45:58 EST 2006

dananrg at wrote:
> This is from a database I didn't design and can't change. 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. Numbers that were specified as
> number(p,s), the module has no problem with.
> Anyone know why this would happen?

I'm sure the Python tutorial explains the difference between integer
and long types. Fields of type NUMBER or DECIMAL might well be larger
than sys.maxint, so you always get longs back when you fetch data
from such a column. This is as it should be.

What seems to be the problem?

If you actually get a suffixed L in the resulting text file, you
are using a strange way to convert your data to text. You aren't
simply printing lists or tuples are you? Then other types, such as
datetime objects will also look bizarre. (Not that the ancient
odbc would support that...)

You might want to look at the csv module for text export.

More information about the Python-list mailing list