Fail to parse WITH query if it contains WINDOW
See original GitHub issueIf a query contains the WINDOW
clause parser fails with the following error:
self = <sql_metadata.parser.Parser object at 0x101e62990>
@property
def with_names(self) -> List[str]:
"""
Returns with statements aliases list from a given query
E.g. WITH database1.tableFromWith AS (SELECT * FROM table3)
SELECT "xxxxx" FROM database1.tableFromWith alias
LEFT JOIN database2.table2 ON ("tt"."ttt"."fff" = "xx"."xxx")
will return ["database1.tableFromWith"]
"""
if self._with_names is not None:
return self._with_names
with_names = UniqueList()
for token in self._not_parsed_tokens:
if token.previous_token.normalized == "WITH":
self._is_in_with_block = True
while self._is_in_with_block and token.next_token:
if token.next_token.is_as_keyword:
self._handle_with_name_save(token=token, with_names=with_names)
while token.next_token and not token.is_with_query_end:
token = token.next_token
> if token.next_token.normalized in WITH_ENDING_KEYWORDS:
E AttributeError: 'NoneType' object has no attribute 'normalized'
../../venv/lib/python3.7/site-packages/sql_metadata/parser.py:449: AttributeError
Query example:
WITH cte_1 AS (
SELECT
column_1
FROM
table_1
WINDOW window_1 AS (
PARTITION BY column_2
)
)
SELECT
column_1
FROM
cte_1 AS alias_1
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Failed to parse the query, no additional information is available.
Hi,. I am getting the below error when I execute a union analytics query. Failed to parse the query, no additional information is...
Read more >URI Search fails with parse error when query string ... - GitHub
I get an error message when including a slash in query string. The query is of the following form: ...
Read more >Parse query string in JavaScript [duplicate] - Stack Overflow
Here is a fast and easy way of parsing query strings in JavaScript: function getQueryVariable(variable) { var query = window.location.search.substring(1); ...
Read more >failed to parse SQL query: ORA-01403 No Data Found
Hi, i ´ve a query that gives me that error when i´m working with a special user. 3 others users don´t get this...
Read more >KB484403: Unable to parse the command line output when ...
In a Spanish localized Windows environments, MicroStrategy has observed that the error, 'Unable to parse the Command Line Output,' may ...
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 FreeTop 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
Top GitHub Comments
@vakhmenin, can we close this one as fixed after today’s release?
Thanks a lot!🙏🏻