mysql.connector.errors.ProgrammingError: 1064 (4200): You have an error in your SQL syntax;

前端 未结 7 1962
暖寄归人
暖寄归人 2021-01-03 01:02

I am attempting to insert data into a MySQL database. I am using python 2.7 and I am using the mysql.connector.

My error is:

mysql.connecto

相关标签:
7条回答
  • 2021-01-03 01:54

    You have to convert the tuple which contains the value to insert into a 'full tuple'. e.g.:

    for np in blob.noun_phrases:
            np=(np,)
    

    In a generic example, if you just have one column to insert, it would be:

    to_insert=('A value to insert',)
    

    Lastly, if you had multiple values to insert at a time:

    to_insert_multiple=[('value1',), ('value2',), ('valueN',)]
    

    I hope it helps, it worked for me in py3.7

    0 讨论(0)
提交回复
热议问题