79727099

Date: 2025-08-06 09:40:19
Score: 1
Natty:
Report link

So it turns out "sqlparse.token.Keyword" only recognizes DDL and DML keywords and not DQL keywords. so it wasn't even recognizing TOP to be a keyword. I just added another condition for making flag false (I'm also checking for char "@" there)

for i in sql_query:
        if "TOP" in i or "@" in i:
            flag=False

I'll leave a GitHub link which has list of all word, functions and character's recognized by "sqlparse.token.Keyword" https://github.com/andialbrecht/sqlparse/blob/master/sqlparse/keywords.py

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: SAMIBOIII