Skip to content

Ignoring certain parts of the sql #407

Closed Answered by tobymao
sergiuv2020 asked this question in Q&A
Discussion options

You must be logged in to vote

Assuming you're using jinja, you should render it first, so parse_one(render(sql)). SQLGlot needs to parse SQL.

You could also use regex to remove {{ }} assuming that the resulting sql is still valid. The reason why we don't parse Jinja is because Jinja operates on the string level and can be put anywhere, it's impossible to parse everything that Jinja can do.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tobymao
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