Re: mysql insert with tuple

2012-11-22 Thread Christian
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] >

Re: mysql insert with tuple

2012-11-21 Thread 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] > > #This version works, but all varchar fields are in extra '' enclosed. > con.execute(""" INSER

Re: mysql insert with tuple

2012-11-21 Thread Chris Rebert
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(

Re: MySQL Insert

2008-07-16 Thread maestroQC
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

Re: MySQL Insert

2008-07-15 Thread maestroQC
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

Re: MySQL Insert

2008-07-15 Thread Ethan Furman
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

Re: MySQL Insert

2008-07-15 Thread Ethan Furman
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

Re: MySQL Insert

2008-07-15 Thread Carsten Haese
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

Re: MySQL Insert Unicode Problem

2007-04-09 Thread John Nagle
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()