sql-testing-tools 0.2.2__py3-none-any.whl → 0.2.3__py3-none-any.whl

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.
@@ -2,6 +2,7 @@ import sqlparse
2
2
  from sqlparse.sql import Identifier, IdentifierList, Where, Comparison, Function, Parenthesis
3
3
  from sqlparse.tokens import Keyword, DML, Name, Wildcard, Whitespace, Newline
4
4
 
5
+
5
6
  try:
6
7
  import Helper as He
7
8
  except ImportError:
@@ -96,10 +97,21 @@ def _groupby(groupby_, alias_map, baseDict: dict):
96
97
  def _orderby(orderby_, alias_map, baseDict: dict):
97
98
  orderby_tokens = []
98
99
  if isinstance(orderby_, Identifier):
99
- orderby_tokens.append(_identifier(orderby_, alias_map, baseDict).lower())
100
+ if len(orderby_.tokens) > 0 and orderby_.tokens[-1].ttype==Keyword.Order:
101
+ for tok in orderby_.tokens:
102
+ if isinstance(tok, Identifier):
103
+ orderby_tokens.append(_identifier(tok, alias_map, baseDict).lower())
104
+ if tok.ttype==Keyword.Order:
105
+ orderby_tokens[-1] += (" "+tok.value)
106
+ else:
107
+ orderby_tokens.append(_identifier(orderby_, alias_map, baseDict).lower())
108
+ orderby_tokens[-1] += " ASC"
100
109
  elif isinstance(orderby_, IdentifierList):
101
- for identifier in orderby_.get_identifiers():
102
- orderby_tokens.append(_identifier(identifier, alias_map, baseDict).lower())
110
+ for tok in orderby_.tokens:
111
+ if isinstance(tok, Identifier):
112
+ orderby_tokens.append(_identifier(tok, alias_map, baseDict).lower())
113
+ #elif isinstance(orderby_, Order):
114
+ # pass
103
115
  # orderby_tokens.sort()
104
116
  return ",".join(orderby_tokens)
105
117
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sql_testing_tools
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Description-Content-Type: text/markdown
5
5
  Requires-Dist: sqlparse>=0.5.1
6
6
  Requires-Dist: requests>=2.32.3
@@ -18,6 +18,10 @@ A library that normalizes simple SQL queries and compares them first by equality
18
18
 
19
19
  Submit bug reports and features requests at: https://github.com/ValentinHerrmann/sql_testing_tools
20
20
 
21
+ ### V 0.2.3
22
+ - fix: ASC/DESC in ORDER BY (also with multiple columns and order directions), no direction treated as ASC
23
+ - Verified that ; and whitespaces, linebreaks at end of query are ignored
24
+
21
25
  ### V 0.2.2
22
26
  - Support LIKE
23
27
  - Support '<=' and '>=' (geq and leq)
@@ -36,6 +40,7 @@ Submit bug reports and features requests at: https://github.com/ValentinHerrmann
36
40
 
37
41
  ### V 0.1.4 + V 0.1.5
38
42
  - Chained conditions (with AND,OR and Paranthesises) in WHERE statement
43
+ - Aggregate Functions
39
44
 
40
45
  ### V 0.1.3
41
46
  - SELECT: columns with our without table prefix
@@ -0,0 +1,8 @@
1
+ sql_testing_tools/BaseAccess.py,sha256=NRbycUOSqYt2qKvggFurHMEV2-gkiJlf3Cr9xLjypIM,5050
2
+ sql_testing_tools/Helper.py,sha256=Kw2V3ifeyLaO1wqvpwArXf5Bgyf_m0vcvY-VJuXUaEU,7943
3
+ sql_testing_tools/TokenProcessing.py,sha256=S3TCdE6XVuR1G14UeQJ4vVtWFt-xahQlHqu-utEhkro,13598
4
+ sql_testing_tools/__init__.py,sha256=eihMp9aizQd5Lnegu0y57WcyCinmy4Jvp66e0fiMPU4,49
5
+ sql_testing_tools-0.2.3.dist-info/METADATA,sha256=t0QCUGMF_yY7edFcJFS22qNYWLD8lN7CADn8ANn713c,1798
6
+ sql_testing_tools-0.2.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ sql_testing_tools-0.2.3.dist-info/top_level.txt,sha256=qwEkmfJ_lYhIwcLXgfU75m0_JavVbOg96fN2zSatN3E,18
8
+ sql_testing_tools-0.2.3.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- sql_testing_tools/BaseAccess.py,sha256=NRbycUOSqYt2qKvggFurHMEV2-gkiJlf3Cr9xLjypIM,5050
2
- sql_testing_tools/Helper.py,sha256=Kw2V3ifeyLaO1wqvpwArXf5Bgyf_m0vcvY-VJuXUaEU,7943
3
- sql_testing_tools/TokenProcessing.py,sha256=5J802sQ4vADnEWkvIgiySIpRJG3FkZ9xoIx7Ronn8u4,13100
4
- sql_testing_tools/__init__.py,sha256=eihMp9aizQd5Lnegu0y57WcyCinmy4Jvp66e0fiMPU4,49
5
- sql_testing_tools-0.2.2.dist-info/METADATA,sha256=nxkO6GhScm6PfgeRi3IIAlPOSgqOka8slz3UvBvUG08,1582
6
- sql_testing_tools-0.2.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- sql_testing_tools-0.2.2.dist-info/top_level.txt,sha256=qwEkmfJ_lYhIwcLXgfU75m0_JavVbOg96fN2zSatN3E,18
8
- sql_testing_tools-0.2.2.dist-info/RECORD,,