sql-testing-tools 0.2.12__tar.gz → 0.2.13__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.4
2
2
  Name: sql_testing_tools
3
- Version: 0.2.12
3
+ Version: 0.2.13
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Requires-Dist: sqlparse>=0.5.1
@@ -135,9 +135,13 @@ res = checkEquality()
135
135
 
136
136
  ### Changelog
137
137
 
138
+ ##### V 0.2.13
139
+ - Acccept `COUNT(colname)`, too (instead of just `COUNT(*)`)
140
+
138
141
  ##### V 0.2.12
139
142
  - fixed bug when having only one colum selected
140
143
  - fixed bug with nested conditions
144
+ - fixed memory problem with huge cross products (used to lead to build failed)
141
145
 
142
146
  ##### V 0.2.11
143
147
  - fixed irrelevant equality order if both sides aren't literals
@@ -123,9 +123,13 @@ res = checkEquality()
123
123
 
124
124
  ### Changelog
125
125
 
126
+ ##### V 0.2.13
127
+ - Acccept `COUNT(colname)`, too (instead of just `COUNT(*)`)
128
+
126
129
  ##### V 0.2.12
127
130
  - fixed bug when having only one colum selected
128
131
  - fixed bug with nested conditions
132
+ - fixed memory problem with huge cross products (used to lead to build failed)
129
133
 
130
134
  ##### V 0.2.11
131
135
  - fixed irrelevant equality order if both sides aren't literals
@@ -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.12',
9
+ version='0.2.13',
10
10
  packages=find_packages(),
11
11
  install_requires=[
12
12
  'sqlparse>=0.5.1',
@@ -46,12 +46,16 @@ def _select(select, alias_map, base_dict: dict, insideFunction=False):
46
46
  else:
47
47
  select_tokens.append(f"{_identifier(token, alias_map, base_dict).lower()} as {token.get_real_name().lower()}")
48
48
  elif isinstance(token, Function):
49
- #select_tokens.append(f"{token.get_name().lower()}({_identifier(token.get_parameters(), alias_map, base_dict).lower()})")
49
+ is_count = False
50
50
  for par in token.tokens:
51
51
  if isinstance(par, Identifier):
52
52
  select_tokens.append(par.get_name().lower()+"(")
53
+ is_count = par.get_name().lower() == "count"
53
54
  if isinstance(par, Parenthesis):
54
- select_tokens[-1] += _select(par, alias_map, base_dict, True)+") as funcResult"
55
+ select_ident = _select(par, alias_map, base_dict, True)
56
+ if is_count and not any(tok.value.upper() == "DISTINCT" for tok in par.tokens):
57
+ select_ident = "*"
58
+ select_tokens[-1] += select_ident +") as funcResult"
55
59
  elif token.ttype is Wildcard:
56
60
  select_tokens.append("*")
57
61
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sql_testing_tools
3
- Version: 0.2.12
3
+ Version: 0.2.13
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Requires-Dist: sqlparse>=0.5.1
@@ -135,9 +135,13 @@ res = checkEquality()
135
135
 
136
136
  ### Changelog
137
137
 
138
+ ##### V 0.2.13
139
+ - Acccept `COUNT(colname)`, too (instead of just `COUNT(*)`)
140
+
138
141
  ##### V 0.2.12
139
142
  - fixed bug when having only one colum selected
140
143
  - fixed bug with nested conditions
144
+ - fixed memory problem with huge cross products (used to lead to build failed)
141
145
 
142
146
  ##### V 0.2.11
143
147
  - fixed irrelevant equality order if both sides aren't literals