473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1033

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sheila King | last post by:
I have searched for an answer to this question on the comp.lang.python archives at Google Groups, and also looked through the (sparse) MySQLdb documentation, and cannot confirm for a FACT what I...
1
by: JZ | last post by:
I cannot execute insert data into TEXT field if that data is bigger than 64KB. :( >>> cursor.execute("INSERT INTO table (field) VALUES(%s) WHERE id=1", myValue) Traceback (most recent call...
5
by: Phillip | last post by:
Hi. I hate the way one has to jump through countless hoops to put data in a db and get it out again. The straightforward MySQLdb Interface requireing this SQL stuff being a point in case (against...
2
by: olekristianvillabo | last post by:
The method cursor.executemany is there in order to avoid multiple calls to cursor.execute(). I have tried, with success, to do like every single example (that I have found on the www) on the...
0
by: Ed Hotchkiss | last post by:
Ok. I am trying to read a csv file with three strings separated by commas. I am trying to insert them into a MySQL DB online. MySQLdb is installed, no problems. I think that I am having some...
3
by: David Mitchell | last post by:
Hello, I am a complete beginner with Python. I've managed to get mod_python up and running with Apache2 and I'm trying to a simple insert into a table in a MySQL database. I'm using the...
1
by: shearichard | last post by:
Hi - I have written some python to insert a row into a table using MySQLDB. I have never before written SQL/Python using embedded parameters in the SQL and I'm having some difficulties. Could...
5
by: Nicolay A. Vasiliev | last post by:
Hello there! I got some trouble trying to insert data into the database with MySQLdb module. I have such code: from MySQLdb import * def loc_connect_db():
1
by: TT | last post by:
I'm trying to using the following code insert a long string into a MySQL table, the data type is of that column is TEXT. When the length of the content is longer than 65K, it get truncated in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.