obj = open(r'captcha.jpg', 'rb').read()
sql = f"update personal_picture set picture='{obj}' where pp_name='{c}';"
cursor = ali_per_conn.cursor()
cursor.execute(sql)
代码如上,想把一个图片更新到数据库,总是出现如下错误
err.raise_mysql_exception(self._data)
File "C:\Users\25808\AppData\Local\Programs\Python\Python37\lib\site-packages\pymysql\err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\\xff\\xd8\\xff\\xe0\\x00\\x10JFIF\\x00\\x01\\x02\\x00\\x00\\x01\\x00\\x01\\x00\\x00\\xff\\xdb\\x00' at line 1")
请大神指点一下