Skip to content

What would be a simple way to count the number of Joins (both explicit and implict Joins). #1155

Closed Answered by barakalon
CBQu asked this question in Q&A
Discussion options

You must be logged in to vote

By "implicit joins", I'm assuming you mean this:

SELECT
  *
FROM x, y

If you're just trying to count the number of joined tables:

expression = parse_one("SELECT ...")
implicit_joins = set()
for from_ in expression.find_all(exp.From):
    implicit_joins.update(from_.expressions[1:])

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@CBQu
Comment options

@tobymao
Comment options

@CBQu
Comment options

@barakalon
Comment options

@CBQu
Comment options

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