sql-testing-tools 0.2.2__tar.gz → 0.2.3__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,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
@@ -8,6 +8,10 @@ A library that normalizes simple SQL queries and compares them first by equality
8
8
 
9
9
  Submit bug reports and features requests at: https://github.com/ValentinHerrmann/sql_testing_tools
10
10
 
11
+ ### V 0.2.3
12
+ - fix: ASC/DESC in ORDER BY (also with multiple columns and order directions), no direction treated as ASC
13
+ - Verified that ; and whitespaces, linebreaks at end of query are ignored
14
+
11
15
  ### V 0.2.2
12
16
  - Support LIKE
13
17
  - Support '<=' and '>=' (geq and leq)
@@ -26,6 +30,7 @@ Submit bug reports and features requests at: https://github.com/ValentinHerrmann
26
30
 
27
31
  ### V 0.1.4 + V 0.1.5
28
32
  - Chained conditions (with AND,OR and Paranthesises) in WHERE statement
33
+ - Aggregate Functions
29
34
 
30
35
  ### V 0.1.3
31
36
  - SELECT: columns with our without table prefix
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
 
7
7
  setup(
8
8
  name='sql_testing_tools',
9
- version='0.2.2',
9
+ version='0.2.3',
10
10
  packages=find_packages(),
11
11
  install_requires=[
12
12
  'sqlparse>=0.5.1',
@@ -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