I am storing information about files that I read in from files in binary. I am using mysql to store the information. One of the columns is the absolute path of the file. This code will run periodically so I want to check that this specific file hasn’t been parsed before.
I am trying to execute:
path = os.path.join(root,f)
sql = "SELECT * FROM %s WHERE Filepath = %s" % ("tntfiles", path)
But to no avail. I get an error saying: “1064, “You have an error in your SQL syntax”
I’ve tried doing the same query with ` around the path:
path = "`" + path + "`'"
but I get: “1064, “You have an error in your SQL syntax”
I’m not sure what I’m doing wring because I can execute a similar query with
"SELECT * FROM %s WHERE Id = %s" % ("tntfiles","1")
and it works just fine.
Thanks
MySQL needs to have strings surrounded by ‘ or ” – so just change the code to