468,294 Members | 1,802 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,294 developers. It's quick & easy.

MySQLdb insert fails on one table

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
0 911

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Sheila King | last post: by
1 post views Thread by JZ | last post: by
5 posts views Thread by Phillip | last post: by
reply views Thread by Ed Hotchkiss | last post: by
3 posts views Thread by David Mitchell | last post: by
5 posts views Thread by Nicolay A. Vasiliev | last post: by
1 post views Thread by TT | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.