[Zope-DB] Newbie: Number appended with L?

Charlie Clark charlie at egenix.com
Tue Feb 24 16:20:17 EST 2004

Dear Chris,

this doesn't seem much of a Zope issue but let's see if we can help you. 
Personally I wouldn't recommend using a pickle as storage: either convert 
directly from one DB to another or use a CSV-file as a standardised text 

But to your problem: your database is returning 40055 and 842 as long 
integers back any Python is recognizing this type of integer and passing it 
on. MySQL unlike PostgreSQL isn't very fussy about types which is a very bad 
thing so it just ignores the L and stores the value. PostgreSQL doesn't 
ignore this but correctly raises a type error. You should be able to get 
around this by quoting the value the database correctly but to help you on 
that we need to see what code your using.



On 2004-02-24 at 20:49:03 [+0100], Sorisio, Chris wrote:
> Hola folks,
> I'm trying to extract a subset of data from an Oracle database and import it
> into a PostgreSQL database.  The scripts I've written work fine with MySQL,
> but I've encountered some problems trying to modify them to work with PG.
> Currently, I dump my results into a pickle file, and use another script to
> upload them into the database.  One row of data after extraction looks like:
> ['sand', 40055L, 'WALLACE', 'HUTTON', 'HUTTON,WALLACE', None, '2003-07-24',
> 'LAD', None, None, None, 'M', 842L, '1998-12-22', 'PAB']
> Why is there an L after 40055, and another after 842?  Is there something
> else I should be doing to cleanse those numbers?
> When I import the data into MySQL, it works fine and isn't irritated by the
> L's.  PostgreSQL, however, is rather upset about them (and the None's, which
> I can turn into NULL's easily enough.)
> Any insight most appreciated,
> Chris
Charlie Clark

Professional Python Services directly from the Source
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Zope-DB mailing list