Skip to content

Find an expression at the top level #1807

Closed Answered by georgesittas
avin-kavish asked this question in Q&A
Discussion options

You must be logged in to vote

If you know that query will always be a SELECT expression (i.e. no DDLs), you can do what you want in a simpler way:

parsed_query = sqlglot.parse_one(query)
print(parsed_query.args.get("limit") or "The query has no LIMIT clause")

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by georgesittas
Comment options

You must be logged in to vote
1 reply
@georgesittas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants