Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with_name marked as table #413

Open
isadofschi opened this issue Aug 18, 2023 · 0 comments
Open

with_name marked as table #413

isadofschi opened this issue Aug 18, 2023 · 0 comments
Labels

Comments

@isadofschi
Copy link

Hi! Thank you, your package is very useful to us!

We encountered a minor issue with a query where some with_name is incorrectly marked as a table. I built this minimal example:

import sql_metadata

query = """
with
A as (
	with intermediate_query as (
		select
			id,
			some_column
		from table_one
	)
	select
	    id,
	    some_column
	from intermediate_query
),
B as (
	select
	    id,
	    other_column
	from table_two
)
select
	A.id,
	some_column,
	other_column
from A
inner join B
on A.id = B.id
"""
parser = sql_metadata.Parser(query)
parser.tables, parser.with_names

With version 2.8.0 I get
(['table_one', 'B', 'table_two'], ['A', 'intermediate_table'])

@macbre macbre added the bug label Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants