sql-testing-tools 0.2.12__tar.gz → 0.3.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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sql_testing_tools
3
- Version: 0.2.12
3
+ Version: 0.3.0
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Requires-Dist: sqlparse>=0.5.1
@@ -74,6 +74,7 @@ Currently supported to use with DB name are:
74
74
  16. `dbiu.videospiele_einfach`: https://www.dbiu.de/videospiele
75
75
  17. `dbiu.videospiele`: https://www.dbiu.de/videospiele2
76
76
  18. `dbiu.wetterdaten`: https://www.dbiu.de/wetterdaten
77
+ 19. `dbiu.terra`: https://terra.sachsen.schule/
77
78
 
78
79
  **Option 2:** Use your own SQLite database with relative path starting at the working dir of your test repository.
79
80
  ``` python
@@ -133,11 +134,46 @@ res = checkEquality()
133
134
 
134
135
 
135
136
 
136
- ### Changelog
137
+ ## Changelog
138
+
139
+ ### Version 0.3 (since 0.2)
140
+ #### SQL Features
141
+ - Support `LIMIT` clause
142
+ - Support `LIKE` operator
143
+ - Support `<=` and `>=` (leq and geq)
144
+ - Support `ASC`/`DESC` in `ORDER BY` (also with multiple columns and order directions), no direction treated as `ASC`
145
+ - Support `NOT`
146
+ - Accept `COUNT(colname)` in addition to `COUNT(*)`
147
+ - Normalize string inequality: `<>`, `!=`, `NOT LIKE` → `NOT...LIKE...`
148
+ - Ignore case in `=` string comparison and therefore `convert` to LIKE (if no `%`, `_` in string)
149
+
150
+ #### Test Features
151
+ - Added support for [dbiu.de](https://www.datenbanken-im-unterricht.de/catalog.php) databases 1-18 (loaded via [dbiu_databases](https://github.com/ValentinHerrmann/dbiu_databases)) with option to still load DBs from local repo
152
+ - Added more check methods for single parts of queries: `checkColumns`, `checkTables`, `checkCondition`, `checkOrder`, `checkGroup`, `checkKeywords`
153
+ - Improved documentation
154
+ - Verified that `;`, whitespaces (at the ende of the query), and linebreaks are ignored
155
+
156
+ #### Bug Fixes
157
+ - Fixed bug when having only one column selected
158
+ - Fixed handling of nested conditions with parantheses
159
+ - Fixed memory problem with huge cross products (used to lead to build failed)
160
+ - Fixed bug that forced irrelevant equality order if both sides aren't literals
161
+ - Fixed part checks if keywords are in wrong order
162
+ - Fixed bug in checkKeywords: if keyword was present in one query and not in the other, the comparison was not performed correctly
163
+
164
+ #### Other
165
+ - added dbiu.terra database support
166
+
167
+ <details>
168
+ <summary>Detailed Changelogs of Versions 0.2.x</summary>
169
+
170
+ ##### V 0.2.13
171
+ - Acccept `COUNT(colname)`, too (instead of just `COUNT(*)`)
137
172
 
138
173
  ##### V 0.2.12
139
174
  - fixed bug when having only one colum selected
140
175
  - fixed bug with nested conditions
176
+ - fixed memory problem with huge cross products (used to lead to build failed)
141
177
 
142
178
  ##### V 0.2.11
143
179
  - fixed irrelevant equality order if both sides aren't literals
@@ -176,9 +212,35 @@ res = checkEquality()
176
212
  ##### V 0.2.1
177
213
  - Support LIMIT
178
214
 
215
+
216
+ </details>
217
+
218
+ ---
219
+
220
+ ### Version 0.2
221
+ #### SQL Features
222
+ - Support SELECT: columns with our without table prefix
223
+ - Support FROM: one or more table from DB; no queries as tables!
224
+ - Support WHERE: single conditions; no Paranthesises!
225
+ - Support GROUP BY one or more columns
226
+ - Support Support ORDER BY
227
+ - Support chained conditions (with AND,OR and Paranthesises) in WHERE statement
228
+ - Support aggregate functions
229
+
230
+
231
+ #### Bug Fixes
232
+ - Fixed import error to ensure imports working in different environments
233
+ - Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
234
+
235
+
236
+
237
+
238
+
239
+ <details>
240
+ <summary>Detailed Changelogs of Versions 0.1.x</summary>
241
+
179
242
  ##### V 0.1.9 + 0.2.0
180
243
  - Support ORDER BY
181
-
182
244
  ##### V 0.1.8
183
245
  - Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
184
246
 
@@ -195,3 +257,4 @@ res = checkEquality()
195
257
  - WHERE: single conditions; no Paranthesises!
196
258
  - GROUP BY one or more columns
197
259
 
260
+ </details>
@@ -62,6 +62,7 @@ Currently supported to use with DB name are:
62
62
  16. `dbiu.videospiele_einfach`: https://www.dbiu.de/videospiele
63
63
  17. `dbiu.videospiele`: https://www.dbiu.de/videospiele2
64
64
  18. `dbiu.wetterdaten`: https://www.dbiu.de/wetterdaten
65
+ 19. `dbiu.terra`: https://terra.sachsen.schule/
65
66
 
66
67
  **Option 2:** Use your own SQLite database with relative path starting at the working dir of your test repository.
67
68
  ``` python
@@ -121,11 +122,46 @@ res = checkEquality()
121
122
 
122
123
 
123
124
 
124
- ### Changelog
125
+ ## Changelog
126
+
127
+ ### Version 0.3 (since 0.2)
128
+ #### SQL Features
129
+ - Support `LIMIT` clause
130
+ - Support `LIKE` operator
131
+ - Support `<=` and `>=` (leq and geq)
132
+ - Support `ASC`/`DESC` in `ORDER BY` (also with multiple columns and order directions), no direction treated as `ASC`
133
+ - Support `NOT`
134
+ - Accept `COUNT(colname)` in addition to `COUNT(*)`
135
+ - Normalize string inequality: `<>`, `!=`, `NOT LIKE` → `NOT...LIKE...`
136
+ - Ignore case in `=` string comparison and therefore `convert` to LIKE (if no `%`, `_` in string)
137
+
138
+ #### Test Features
139
+ - Added support for [dbiu.de](https://www.datenbanken-im-unterricht.de/catalog.php) databases 1-18 (loaded via [dbiu_databases](https://github.com/ValentinHerrmann/dbiu_databases)) with option to still load DBs from local repo
140
+ - Added more check methods for single parts of queries: `checkColumns`, `checkTables`, `checkCondition`, `checkOrder`, `checkGroup`, `checkKeywords`
141
+ - Improved documentation
142
+ - Verified that `;`, whitespaces (at the ende of the query), and linebreaks are ignored
143
+
144
+ #### Bug Fixes
145
+ - Fixed bug when having only one column selected
146
+ - Fixed handling of nested conditions with parantheses
147
+ - Fixed memory problem with huge cross products (used to lead to build failed)
148
+ - Fixed bug that forced irrelevant equality order if both sides aren't literals
149
+ - Fixed part checks if keywords are in wrong order
150
+ - Fixed bug in checkKeywords: if keyword was present in one query and not in the other, the comparison was not performed correctly
151
+
152
+ #### Other
153
+ - added dbiu.terra database support
154
+
155
+ <details>
156
+ <summary>Detailed Changelogs of Versions 0.2.x</summary>
157
+
158
+ ##### V 0.2.13
159
+ - Acccept `COUNT(colname)`, too (instead of just `COUNT(*)`)
125
160
 
126
161
  ##### V 0.2.12
127
162
  - fixed bug when having only one colum selected
128
163
  - fixed bug with nested conditions
164
+ - fixed memory problem with huge cross products (used to lead to build failed)
129
165
 
130
166
  ##### V 0.2.11
131
167
  - fixed irrelevant equality order if both sides aren't literals
@@ -164,9 +200,35 @@ res = checkEquality()
164
200
  ##### V 0.2.1
165
201
  - Support LIMIT
166
202
 
203
+
204
+ </details>
205
+
206
+ ---
207
+
208
+ ### Version 0.2
209
+ #### SQL Features
210
+ - Support SELECT: columns with our without table prefix
211
+ - Support FROM: one or more table from DB; no queries as tables!
212
+ - Support WHERE: single conditions; no Paranthesises!
213
+ - Support GROUP BY one or more columns
214
+ - Support Support ORDER BY
215
+ - Support chained conditions (with AND,OR and Paranthesises) in WHERE statement
216
+ - Support aggregate functions
217
+
218
+
219
+ #### Bug Fixes
220
+ - Fixed import error to ensure imports working in different environments
221
+ - Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
222
+
223
+
224
+
225
+
226
+
227
+ <details>
228
+ <summary>Detailed Changelogs of Versions 0.1.x</summary>
229
+
167
230
  ##### V 0.1.9 + 0.2.0
168
231
  - Support ORDER BY
169
-
170
232
  ##### V 0.1.8
171
233
  - Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
172
234
 
@@ -183,3 +245,4 @@ res = checkEquality()
183
245
  - WHERE: single conditions; no Paranthesises!
184
246
  - GROUP BY one or more columns
185
247
 
248
+ </details>
@@ -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.3.0',
10
10
  packages=find_packages(),
11
11
  install_requires=[
12
12
  'sqlparse>=0.5.1',
@@ -22,7 +22,8 @@ dbMap = {
22
22
  "dbiu.unfallstatistik": 15,
23
23
  "dbiu.videospiele_einfach": 16,
24
24
  "dbiu.videospiele": 17,
25
- "dbiu.wetterdaten": 18
25
+ "dbiu.wetterdaten": 18,
26
+ "dbiu.terra": 19
26
27
  }
27
28
 
28
29
  __db=""
@@ -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.3.0
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Requires-Dist: sqlparse>=0.5.1
@@ -74,6 +74,7 @@ Currently supported to use with DB name are:
74
74
  16. `dbiu.videospiele_einfach`: https://www.dbiu.de/videospiele
75
75
  17. `dbiu.videospiele`: https://www.dbiu.de/videospiele2
76
76
  18. `dbiu.wetterdaten`: https://www.dbiu.de/wetterdaten
77
+ 19. `dbiu.terra`: https://terra.sachsen.schule/
77
78
 
78
79
  **Option 2:** Use your own SQLite database with relative path starting at the working dir of your test repository.
79
80
  ``` python
@@ -133,11 +134,46 @@ res = checkEquality()
133
134
 
134
135
 
135
136
 
136
- ### Changelog
137
+ ## Changelog
138
+
139
+ ### Version 0.3 (since 0.2)
140
+ #### SQL Features
141
+ - Support `LIMIT` clause
142
+ - Support `LIKE` operator
143
+ - Support `<=` and `>=` (leq and geq)
144
+ - Support `ASC`/`DESC` in `ORDER BY` (also with multiple columns and order directions), no direction treated as `ASC`
145
+ - Support `NOT`
146
+ - Accept `COUNT(colname)` in addition to `COUNT(*)`
147
+ - Normalize string inequality: `<>`, `!=`, `NOT LIKE` → `NOT...LIKE...`
148
+ - Ignore case in `=` string comparison and therefore `convert` to LIKE (if no `%`, `_` in string)
149
+
150
+ #### Test Features
151
+ - Added support for [dbiu.de](https://www.datenbanken-im-unterricht.de/catalog.php) databases 1-18 (loaded via [dbiu_databases](https://github.com/ValentinHerrmann/dbiu_databases)) with option to still load DBs from local repo
152
+ - Added more check methods for single parts of queries: `checkColumns`, `checkTables`, `checkCondition`, `checkOrder`, `checkGroup`, `checkKeywords`
153
+ - Improved documentation
154
+ - Verified that `;`, whitespaces (at the ende of the query), and linebreaks are ignored
155
+
156
+ #### Bug Fixes
157
+ - Fixed bug when having only one column selected
158
+ - Fixed handling of nested conditions with parantheses
159
+ - Fixed memory problem with huge cross products (used to lead to build failed)
160
+ - Fixed bug that forced irrelevant equality order if both sides aren't literals
161
+ - Fixed part checks if keywords are in wrong order
162
+ - Fixed bug in checkKeywords: if keyword was present in one query and not in the other, the comparison was not performed correctly
163
+
164
+ #### Other
165
+ - added dbiu.terra database support
166
+
167
+ <details>
168
+ <summary>Detailed Changelogs of Versions 0.2.x</summary>
169
+
170
+ ##### V 0.2.13
171
+ - Acccept `COUNT(colname)`, too (instead of just `COUNT(*)`)
137
172
 
138
173
  ##### V 0.2.12
139
174
  - fixed bug when having only one colum selected
140
175
  - fixed bug with nested conditions
176
+ - fixed memory problem with huge cross products (used to lead to build failed)
141
177
 
142
178
  ##### V 0.2.11
143
179
  - fixed irrelevant equality order if both sides aren't literals
@@ -176,9 +212,35 @@ res = checkEquality()
176
212
  ##### V 0.2.1
177
213
  - Support LIMIT
178
214
 
215
+
216
+ </details>
217
+
218
+ ---
219
+
220
+ ### Version 0.2
221
+ #### SQL Features
222
+ - Support SELECT: columns with our without table prefix
223
+ - Support FROM: one or more table from DB; no queries as tables!
224
+ - Support WHERE: single conditions; no Paranthesises!
225
+ - Support GROUP BY one or more columns
226
+ - Support Support ORDER BY
227
+ - Support chained conditions (with AND,OR and Paranthesises) in WHERE statement
228
+ - Support aggregate functions
229
+
230
+
231
+ #### Bug Fixes
232
+ - Fixed import error to ensure imports working in different environments
233
+ - Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
234
+
235
+
236
+
237
+
238
+
239
+ <details>
240
+ <summary>Detailed Changelogs of Versions 0.1.x</summary>
241
+
179
242
  ##### V 0.1.9 + 0.2.0
180
243
  - Support ORDER BY
181
-
182
244
  ##### V 0.1.8
183
245
  - Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
184
246
 
@@ -195,3 +257,4 @@ res = checkEquality()
195
257
  - WHERE: single conditions; no Paranthesises!
196
258
  - GROUP BY one or more columns
197
259
 
260
+ </details>