As the title says, I want to check the syntax of a query just before executing it in Python.
For example, a function named check_syntax
:
correct_sql = "select * from table;"
wrong_sql = "selecccct * from table;"
check_syntax(correct_sql) # return True
check_syntax(wrong_sql) # return False
I wonder, is there any library in Python that can help? I have looked into sqlparse
, but it doesn't help.