By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,097 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,097 IT Pros & Developers. It's quick & easy.

MySQLdb insert fails on one table

P: n/a
I have this table

mysqldescribe valid_individuals;
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| fname | varchar(30) | YES | | NULL | |
| lname | varchar(30) | YES | | NULL | |
| alias | varchar(30) | YES | | NULL | |
| email | varchar(100) | YES | | NULL | |
+-------+--------------+------+-----+---------+-------+
I call this function

def insertRecords(self, tablename, columnnames, values, clear=True):
cursor = self.Connection.cursor()
sql = "INSERT INTO %s (%s) VALUES (%s)" % (tablename,
','.join(columnnames), ','.join(['%s' for x in columnnames]))
print >>sys.stderr, sql, values[:3]
cursor.executemany(sql, values)
cursor.close()
which prints:
INSERT INTO valid_individuals (fname,lname,alias,email) VALUES (%s,%s,%s,%s)
[['xxxx', 'yyyy', 'zzzzz', 'aaaaaa']]

this function works fine for several other tables, but on this one I get no
errors and there is nothing in the table. If I run the equivalent insert on
the command line, it's just fine.

I'm lost here; Python 2.4.4 and latest MySQLdb for 2.4.4; anyone got a
clue?

---------------------------------------------------------------------------
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---------------------------------------------------------------------------
Jun 1 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.