I looked here. It fixes the error if the code is like:
"""INSERT IGNORE INTO analysing_tweet(created_at) VALUES (("%s"))""" % (tweeted_values["created_at"])
However, after talking to other people, about this error, people have said this practice is bad. So once I fixed it to like this:
query = """INSERT IGNORE INTO analysing_tweet(created_at) VALUES (("%s"))"""
values = (tweet_values["created_at"])
cursor.execute(query, values)
It executes with no problem, but in the database it adds %s
, it looked like this
created_at |
---|
%s |
Versions:
MySQL: 8.0.25
Python: 3.8.10
mysql-connector: 2.2.9
mysql-connector-python: 8.0.25