1
vote
1answer
1k views

Python / MySQL (MySQLdb) - testing the 'insert' function - its not adding rows. Why?

I'm trying to figure out how to use the MySQLdb library in python (I am novice at best for both of them). I'm following the code here: http://www.kitebird.com/articles/pydbapi.html Specifically: ...
1
vote
3answers
298 views

MySQLdb inserting a dict into a table

I have a row of data in dict format. Is there an easy way to insert it into a mysql table. I know that I can write a custom function to convert dict into a custom sql query, but I am looking for a ...
1
vote
3answers
229 views

How can I insert a MySQL row IF one matched does not exist already

My table bank has three columns: uid, nick, and balance. I can insert new row perfectly fine, however it would be easy for duplicates of the nick to appear since the uid auto increments, making each ...
0
votes
1answer
232 views

Python | MySQLdb -> I cant insert

I have an odd problem. There are two databases. One has all products in it for an online shop. The other one has the online-shop software on it and only the active products. I want to take the values ...
0
votes
0answers
47 views

Why do I get these errors “Data truncated for column”?

I use this string to upload my CSV file into a MySQL table. Query = """ LOAD DATA LOCAL INFILE 'Data to file_name.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY ...
-1
votes
1answer
54 views

MySQLdb - Error with simple statement

db = MySQLdb.connect("XXXXXXXX","root", "XXXXXX", database) cursor = db.cursor() cursor.execute('INSERT INTO media_files (ID, DATA) VALUES ("test", "test")') cursor.execute("commit") This statement ...