Its similar to https://stackoverflow.com/questions/377883/how-to-check-if-mysql-query-is-valid-without-executing-it But its for Go and I want a solution in Python. It will be better if there is a built-in tool with MySQL and related DBMS that checks the syntax of the query.
If "without executing it" can be interpreted as "without committing it", then you can execute the statement in a
try...except...finally clause and roll it back if it does not throw an exception.
Of course, that only ensures that your query is valid SQL, not that it "is right" in the sense of doing what you want it to do. An independent code review is the best way to get that assurance.