'Find syntax error IN SQL query using python

I want to parse sql file using python code and find any syntatical error present in the file. Is there any way to do it?



Solution 1:[1]

You can use https://github.com/tobymao/sqlglot

import sqlglot
sqlglot.parse_one("select (")
>> sqlglot.errors.ParseError: Expecting ). Line 1, Col: 8.

select (

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Toby Mao