0
votes
0answers
11 views

Python MySQLdb insert query not working [duplicate]

I am writing a python script that is supposed to insert a list of names from an array (where they are stored as strings) into a table. When I run the dbInsert() method it runs perfectly, however ...
0
votes
1answer
974 views

python mysqldb inserting NULL using a prepared statement

I'm having issues with python when I try to insert NULL into a field using a prepared mysqldb statement. The problem is that python doesn't like NULL without quotes and then MySQL doesn't like 'NULL' ...
-1
votes
1answer
542 views

Syntax Error when inserting data with variables in MySQLdb Python

I am trying to insert some data into a MySQL DB with Python and MySQLdb. When i do the following: query = "INSERT INTO universitats (universitat) VALUES ('%s')" % (lloc) cursor.execute(query) ...
1
vote
0answers
170 views

Unable to Insert into database

I want to insert data into the database using following script.There can be 3 suppliers and with respect to each of them I need to store the Warehouse state and zip code . import MySQLdb as mdb ...
0
votes
0answers
162 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
vote
3answers
465 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
425 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 ...
2
votes
1answer
3k 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
469 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
votes
1answer
76 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 ...