Am Mittwoch, 21. November 2012 20:49:14 UTC+1 schrieb Hans Mulder:
> On 21/11/12 18:19:15, Christian wrote:
>
> > Hi ,
>
> >
>
> > my purpose is a generic insert via tuple , because the number of fields
> > and can differ. But I'm stucking .
>
> >
>
> > ilist=['hello',None,7,None,None]
>
On 21/11/12 18:19:15, Christian wrote:
> Hi ,
>
> my purpose is a generic insert via tuple , because the number of fields and
> can differ. But I'm stucking .
>
> ilist=['hello',None,7,None,None]
>
> #This version works, but all varchar fields are in extra '' enclosed.
> con.execute(""" INSER
On Wed, Nov 21, 2012 at 9:19 AM, Christian wrote:
> Hi ,
>
> my purpose is a generic insert via tuple , because the number of fields and
> can differ. But I'm stucking .
>
> ilist=['hello',None,7,None,None]
>
> #This version works, but all varchar fields are in extra '' enclosed.
> con.execute(
Thanks to all for your time and patience with this!
The insert is working fine based on the suggestions in this thread.
I now have another problem that should be resolved with a regular
expression to remove currency formatting before inserting into the db.
--
http://mail.python.org/mailman/listinf
Thanks for the information.
However I must stick to decimal since I'm dealing with monetary
values.
I loose the decimals with int and float has only supports one decimal
place.
I tried as you suggested to use the %s instead of the %d to no avail.
--
http://mail.python.org/mailman/listinfo/python-l
maestroQC wrote:
Hi,
Its one of those days. I cannot solve this. Any help would be greatly
appreciated!
When I execute this:
class Db(object):
def insertAccount(self, date, accountNumber, description,
openingBalance):
dec = decimal.Decimal(openingBalance)
db = MySQLdb.connec
maestroQC wrote:
Hi,
Its one of those days. I cannot solve this. Any help would be greatly
appreciated!
When I execute this:
class Db(object):
def insertAccount(self, date, accountNumber, description,
openingBalance):
dec = decimal.Decimal(openingBalance)
db = MySQLdb.connec
maestroQC wrote:
cursor.execute("INSERT INTO es_accounts (dateCreated,
accountNumber, description, openingBalance) VALUES (%s, %s, %s
, %d)", (date, accountNumber, description, dec))
File "c:\python25\lib\site-packages\MySQLdb\cursors.py", line 151,
in execute
query = query % db.literal
erikcw wrote:
> Hi,
>
> I'm trying to insert some data from an XML file into MySQL. However,
> while importing one of the files, I got this error:
>
> Traceback (most recent call last):
> File "wa.py", line 304, in ?
> main()
> File "wa.py", line 257, in main
> curHandler.walkData()