nested with statement causes confusion
See original GitHub issueI wrote the following test:
def test_create_table_as_select_with_joins_with():
qry = """
CREATE table xyz as
with sub as (select it_id from internal_table)
SELECT *
from (
with abc as (select * from other_table)
select name, age, it_id
from table_z
join abc on (table_z.it_id = abc.it_id)
) as table_a
join table_b on (table_a.name = table_b.name)
left join table_c on (table_a.age = table_c.age)
left join sub on (table_a.it_id = sub.it_id)
order by table_a.name, table_a.age
"""
parser = Parser(qry)
assert set(parser.tables) == set(["xyz", "table_z", "table_b", "table_c", "internal_table", "other_table"])
which the code is unable to pass, as it thinks with
in the following sub-query:
from (
with abc as (select * from other_table)
select name, age, it_id
from table_z
join abc on (table_z.it_id = abc.it_id)
)
is a table.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Confusion of nested ifelse expression - Stack Overflow
This code aims to define a new column, Y in the data set x . The column Y will populate based on the...
Read more >Getting a Nested With Clause error while creating a Table
Hello,. I am trying to create a table from a query. However I am getting the following error: ORA-32034: unsupported use of WITH...
Read more >Confusion Between For Each and For All in Nested Quantifiers
This expression says that if students x and y are friends, and students x and z are friends, and furthermore, if y and...
Read more >Nested conditionals (if/else/if) | AP CSP (article) | Khan Academy
The above structure can become confusing when we deal with nested conditionals. However, you can remember the general syntactic structure of an if-else ......
Read more >Solved: Nested IF statement - Microsoft Power BI Community
Therefore, all your arguments after it are causing the error. I think you can remove the "SliderValue" argument, or use a SWITCH() function...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tipanverella You just have to put that
with
everywhere, don’t you? 🤣@tipanverella fix for this is already in a PR waiting for @macbre review.
You are already helping with those failing edge cases, thanks to you sql-metadata is becoming better and more universal☺️