Home:ALL Converter>MySQL/Python INSERT INTO Statement Issues

MySQL/Python INSERT INTO Statement Issues

Ask Time:2018-06-20T00:55:51         Author:user9927007

Json Formatter

I'm attempting to test adding data to a database via python. I have recognized that many people have issues with the "INSERT INTO" statement, and I have as well. I have received a range of errors, followed by changing the syntax multiple times, and then receiving new errors.

Currently, I have this as my statement:

cursor.execute("""INSERT INTO test (Column 1,Column 2) VALUES (%s,%s)"""% arg)

Where:

arg=("'5','2'")

Running the code outputs the standard 1064 MySQL error.

If someone can explain to me the standard syntax that would be great, because I can't seem to find it anywhere.

Author:user9927007,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50933434/mysql-python-insert-into-statement-issues
yy