never mind... doh!!!

executemany  as opposed to execute!!!

thanks

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf
Of bruce
Sent: Thursday, August 10, 2006 6:37 PM
To: python-list@python.org
Subject: python/mysql/list question...


hi.

i have the following sample code. i'm trying to figure out if there's a way
to use a 'list of lists' in a mysql execute...

i've tried a variety of combinations but i get an error:
 Error 1241: Operand should contain 1 column(s)

the test code is:

insertSQL = """insert into appTBL
             (appName, universityID)
              values(%s,%s)"""

a = []
b = []
a.append('qqa')
a.append(222)
b.append(a)
a=[]
a.append('bbb')
a.append(66)
b.append(a)

try:
  c.execute(insertSQL, (b[0],b[1]))  <<<<<<<<<<<<<<<<<<<
except MySQLdb.Error, e:
  print "Error %d: %s" % (e.args[0], e.args[1])
  print b
  sys.exit (1)

i've tried to use b, (b), etc...
using b[0] works for the 1st row...


any thoughts/comments...

thanks


-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to