sql-metadata 2.19.0__tar.gz → 2.20.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sql_metadata
3
- Version: 2.19.0
3
+ Version: 2.20.0
4
4
  Summary: Uses tokenized query returned by python-sqlparse and generates query metadata
5
5
  License: MIT
6
6
  License-File: LICENSE
7
7
  Author: Maciej Brencz
8
8
  Author-email: maciej.brencz@gmail.com
9
- Requires-Python: >=3.9,<4.0
9
+ Requires-Python: >=3.10,<4.0
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "sql_metadata"
3
- version = "2.19.0"
3
+ version = "2.20.0"
4
4
  license="MIT"
5
5
  description = "Uses tokenized query returned by python-sqlparse and generates query metadata"
6
6
  authors = ["Maciej Brencz <maciej.brencz@gmail.com>", "Radosław Drążkiewicz <collerek@gmail.com>"]
@@ -13,7 +13,7 @@ packages = [
13
13
  ]
14
14
 
15
15
  [tool.poetry.dependencies]
16
- python = "^3.9"
16
+ python = "^3.10"
17
17
  sqlparse = ">=0.4.1,<0.6.0"
18
18
 
19
19
  [tool.poetry.dev-dependencies]
@@ -447,7 +447,7 @@ class Parser: # pylint: disable=R0902
447
447
  return self._table_aliases
448
448
 
449
449
  @property
450
- def with_names(self) -> List[str]:
450
+ def with_names(self) -> List[str]: # noqa: C901
451
451
  """
452
452
  Returns with statements aliases list from a given query
453
453
 
@@ -474,6 +474,12 @@ class Parser: # pylint: disable=R0902
474
474
  )
475
475
  if is_end_of_with_block:
476
476
  self._is_in_with_block = False
477
+ elif token.next_token and token.next_token.is_as_keyword:
478
+ # Malformed SQL like "... AS (...) AS ..."
479
+ raise ValueError("This query is wrong")
480
+ else:
481
+ # Advance token to prevent infinite loop
482
+ token = token.next_token
477
483
  else:
478
484
  token = token.next_token
479
485
 
@@ -676,7 +682,7 @@ class Parser: # pylint: disable=R0902
676
682
  # like: with (col1, col2) as (subquery) as ..., it enters an infinite loop.
677
683
  # return exception
678
684
  if start_token.is_with_query_start:
679
- raise ValueError("This query is wrong")
685
+ raise ValueError("This query is wrong") # pragma: no cover
680
686
  start_token.is_with_columns_start = True
681
687
  start_token.is_nested_function_start = False
682
688
  prev_token = start_token.previous_token
@@ -176,7 +176,7 @@ class SQLToken: # pylint: disable=R0902, R0904
176
176
  self.is_keyword
177
177
  and self.normalized not in RELEVANT_KEYWORDS
178
178
  and self.previous_token.normalized in [",", "SELECT"]
179
- and self.next_token.normalized in [",", "AS"]
179
+ and self.next_token.normalized in [",", "AS", "FROM"]
180
180
  )
181
181
 
182
182
  @property
File without changes
File without changes