Pymysql 1064,“你的 SQL 语法有错误

Pymysql 1064, "You have an error in your SQL syntax

你能帮我看看我的SQL命令哪里错了吗?非常感谢您。

错误如下。

pymysql.err.ProgrammingError: (1064, "您的 SQL 语法有误;请查看与您的 MySQL 服务器版本对应的手册,了解在 '附近使用的正确语法15:57:41,解决 API 联网汽车服务和车队中的漏洞,第 1 行的 A'")

下面是我的SQL

title=escape_string(filtered_content[0][1])
author=escape_string(filtered_content[0][2])
publishdate=escape_string(filtered_content[0][3])
content=escape_string(filtered_content[0][4])
tags=escape_string(filtered_content[0][5])
url=escape_string(filtered_content[0][6])
dt=escape_string(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
sql = "INSERT INTO {} VALUES (NULL, {}, {}, {}, {}, {}, {}, {}) FROM DUAL WHERE NOT EXISTS(SELECT * FROM {} WHERE url={}".format(self.tableName, dt, title, author, publishdate, content, tags, url, self.tableName, url)
cursor.execute(sql)
db.commit()

EXISTS(SELECT * FROM {} WHERE url={}

末尾没有)