sql-testing-tools 0.2.5__tar.gz → 0.2.7__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.
- {sql_testing_tools-0.2.5/sql_testing_tools.egg-info → sql_testing_tools-0.2.7}/PKG-INFO +8 -1
- sql_testing_tools-0.2.5/PKG-INFO → sql_testing_tools-0.2.7/README.md +7 -10
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/setup.py +1 -1
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools/Helper.py +6 -95
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools/TokenProcessing.py +5 -0
- sql_testing_tools-0.2.5/README.md → sql_testing_tools-0.2.7/sql_testing_tools.egg-info/PKG-INFO +17 -0
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/setup.cfg +0 -0
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools/BaseAccess.py +0 -0
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools/__init__.py +0 -0
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools.egg-info/SOURCES.txt +0 -0
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools.egg-info/dependency_links.txt +0 -0
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools.egg-info/requires.txt +0 -0
- {sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: sql_testing_tools
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Description-Content-Type: text/markdown
|
|
5
5
|
Requires-Dist: sqlparse>=0.5.1
|
|
6
6
|
Requires-Dist: requests>=2.32.3
|
|
@@ -136,6 +136,13 @@ res = checkEquality()
|
|
|
136
136
|
|
|
137
137
|
### Changelog
|
|
138
138
|
|
|
139
|
+
|
|
140
|
+
##### V 0.2.7
|
|
141
|
+
- Normalize String unequality: ...<>..., ...!=..., ...NOT LIKE... --> NOT...LIKE...
|
|
142
|
+
|
|
143
|
+
##### V 0.2.6
|
|
144
|
+
- Fixed bug in checkKeywords: if keyword was present in one query and not in the other, the comparison was not performed correctly.
|
|
145
|
+
|
|
139
146
|
##### V 0.2.5
|
|
140
147
|
- 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.
|
|
141
148
|
- Improved docs
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: sql_testing_tools
|
|
3
|
-
Version: 0.2.5
|
|
4
|
-
Description-Content-Type: text/markdown
|
|
5
|
-
Requires-Dist: sqlparse>=0.5.1
|
|
6
|
-
Requires-Dist: requests>=2.32.3
|
|
7
|
-
Dynamic: description
|
|
8
|
-
Dynamic: description-content-type
|
|
9
|
-
Dynamic: requires-dist
|
|
10
|
-
|
|
11
1
|
A library that normalizes simple SQL queries and compares them first by equality of the normalized string and then using the cosette API.
|
|
12
2
|
|
|
13
3
|
#### [Beta in Development!]
|
|
@@ -136,6 +126,13 @@ res = checkEquality()
|
|
|
136
126
|
|
|
137
127
|
### Changelog
|
|
138
128
|
|
|
129
|
+
|
|
130
|
+
##### V 0.2.7
|
|
131
|
+
- Normalize String unequality: ...<>..., ...!=..., ...NOT LIKE... --> NOT...LIKE...
|
|
132
|
+
|
|
133
|
+
##### V 0.2.6
|
|
134
|
+
- Fixed bug in checkKeywords: if keyword was present in one query and not in the other, the comparison was not performed correctly.
|
|
135
|
+
|
|
139
136
|
##### V 0.2.5
|
|
140
137
|
- 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.
|
|
141
138
|
- Improved docs
|
|
@@ -152,7 +152,7 @@ def buildAndSendCosetteRequest(baseDict, sql, sol):
|
|
|
152
152
|
def checkKeywords(startWord:str, endWords:list):
|
|
153
153
|
global sql,sol
|
|
154
154
|
|
|
155
|
-
if(startWord not in sol
|
|
155
|
+
if(startWord not in sol and startWord not in sql):
|
|
156
156
|
return ""
|
|
157
157
|
|
|
158
158
|
if(startWord in sql):
|
|
@@ -186,119 +186,30 @@ def checkKeywords(startWord:str, endWords:list):
|
|
|
186
186
|
return "Der '"+startWord+"' Teil der SQL-Abfrage ist nicht korrekt (oder nicht automatisch überprüfbar)."
|
|
187
187
|
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
189
|
def checkColumns(sqlPath="", solPath=""):
|
|
192
190
|
global sql,sol
|
|
193
191
|
setup(sqlPath, solPath)
|
|
194
192
|
return checkKeywords("SELECT", ["FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
|
|
195
193
|
|
|
196
194
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if("SELECT" in sql and "FROM" in sql):
|
|
200
|
-
start = str.find(sql, "SELECT")
|
|
201
|
-
end = str.find(sql, "FROM")
|
|
202
|
-
submission = str.strip(sql[start:end])
|
|
203
|
-
print("'"+submission+"'")
|
|
204
|
-
|
|
205
|
-
start = str.find(sol, "SELECT")
|
|
206
|
-
end = str.find(sol, "FROM")
|
|
207
|
-
solution = str.strip(sol[start:end])
|
|
208
|
-
print("'"+solution+"'")
|
|
209
|
-
|
|
210
|
-
if submission == solution:
|
|
211
|
-
return ""
|
|
212
|
-
return "Ausgegebene Spalten sind nicht korrekt (oder nicht automatisch überprüfbar)."
|
|
213
|
-
|
|
214
195
|
def checkTables(sqlPath="", solPath=""):
|
|
215
196
|
global sql,sol
|
|
216
197
|
setup(sqlPath, solPath)
|
|
217
198
|
return checkKeywords("FROM", ["FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
|
|
218
199
|
|
|
219
200
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
if("SELECT" in sql and "FROM" in sql):
|
|
223
|
-
endFromKeywords = ["WHERE", "GROUP", "ORDER", "LIMIT", ";"]
|
|
224
|
-
|
|
225
|
-
start = str.find(sql, "FROM")
|
|
226
|
-
end = -1
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
for keyword in endFromKeywords:
|
|
230
|
-
if(str.find(sql, keyword) != -1):
|
|
231
|
-
end = str.find(sql, keyword)
|
|
232
|
-
break
|
|
233
|
-
if(end == -1):
|
|
234
|
-
end = len(sql)
|
|
235
|
-
|
|
236
|
-
submission = str.strip(sql[start:end])
|
|
237
|
-
print("'"+submission+"'")
|
|
238
|
-
|
|
239
|
-
start = str.find(sol, "FROM")
|
|
240
|
-
end = -1
|
|
241
|
-
|
|
242
|
-
for keyword in endFromKeywords:
|
|
243
|
-
if(str.find(sol, keyword) != -1):
|
|
244
|
-
end = str.find(sol, keyword)
|
|
245
|
-
break
|
|
246
|
-
if(end == -1):
|
|
247
|
-
end = len(sol)
|
|
248
|
-
|
|
249
|
-
solution = str.strip(sol[start:end])
|
|
250
|
-
print("'"+solution+"'")
|
|
251
|
-
|
|
252
|
-
if submission == solution:
|
|
253
|
-
return ""
|
|
254
|
-
return "Verwendete Tabellen sind nicht korrekt (oder nicht automatisch überprüfbar)."
|
|
255
|
-
|
|
256
201
|
def checkCondition(sqlPath="", solPath=""):
|
|
257
202
|
global sql,sol
|
|
258
203
|
setup(sqlPath, solPath)
|
|
259
204
|
return checkKeywords("WHERE", ["GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
|
|
260
205
|
|
|
206
|
+
|
|
261
207
|
def checkOrder(sqlPath="", solPath=""):
|
|
262
208
|
global sql,sol
|
|
263
209
|
setup(sqlPath, solPath)
|
|
264
210
|
return checkKeywords("ORDER BY", ["WHERE", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
|
|
265
211
|
|
|
266
212
|
|
|
267
|
-
|
|
268
|
-
if("ORDER BY" in sql):
|
|
269
|
-
endFromKeywords = ["WHERE", "GROUP", "LIMIT", ";"]
|
|
270
|
-
|
|
271
|
-
start = str.find(sql, "ORDER BY")
|
|
272
|
-
end = -1
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
for keyword in endFromKeywords:
|
|
276
|
-
if(str.find(sql, keyword) != -1):
|
|
277
|
-
end = str.find(sql, keyword)
|
|
278
|
-
break
|
|
279
|
-
if(end == -1):
|
|
280
|
-
end = len(sql)
|
|
281
|
-
|
|
282
|
-
submission = str.strip(sql[start:end])
|
|
283
|
-
print("'"+submission+"'")
|
|
284
|
-
|
|
285
|
-
start = str.find(sol, "ORDER BY")
|
|
286
|
-
end = -1
|
|
287
|
-
|
|
288
|
-
for keyword in endFromKeywords:
|
|
289
|
-
if(str.find(sol, keyword) != -1):
|
|
290
|
-
end = str.find(sol, keyword)
|
|
291
|
-
break
|
|
292
|
-
if(end == -1):
|
|
293
|
-
end = len(sol)
|
|
294
|
-
|
|
295
|
-
solution = str.strip(sol[start:end])
|
|
296
|
-
print("'"+solution+"'")
|
|
297
|
-
|
|
298
|
-
if submission == solution:
|
|
299
|
-
return ""
|
|
300
|
-
return "Die Sortierung ist nicht korrekt (oder nicht automatisch überprüfbar)."
|
|
301
|
-
|
|
302
213
|
def checkGroup(sqlPath="", solPath=""):
|
|
303
214
|
global sql,sol
|
|
304
215
|
setup(sqlPath, solPath)
|
|
@@ -306,17 +217,17 @@ def checkGroup(sqlPath="", solPath=""):
|
|
|
306
217
|
|
|
307
218
|
|
|
308
219
|
def checkEquality(sqlPath="", solPath=""):
|
|
309
|
-
global sql,sol
|
|
220
|
+
global sql, sol
|
|
310
221
|
setup(sqlPath, solPath)
|
|
311
222
|
|
|
312
|
-
if
|
|
223
|
+
if sql == sol:
|
|
313
224
|
return ""
|
|
314
225
|
|
|
315
226
|
result = buildAndSendCosetteRequest(bd, sql, sol)
|
|
316
227
|
|
|
317
|
-
if
|
|
228
|
+
if result[0] == "ERR":
|
|
318
229
|
return "\n\nFehler bei der automatischen Überprüfung der Abgabe. Es kann keine Aussage über die Korrektheit der Abgabe getroffen werden."
|
|
319
|
-
elif
|
|
230
|
+
elif result[0] != "EQ":
|
|
320
231
|
return "\n\nDie Abgabe stimmt nicht mit der Musterlösung überein."
|
|
321
232
|
return ""
|
|
322
233
|
|
|
@@ -143,6 +143,11 @@ def _condition(token, alias_map, baseDict: dict):
|
|
|
143
143
|
left = _identifier(left, alias_map, baseDict)
|
|
144
144
|
right = _identifier(right, alias_map, baseDict)
|
|
145
145
|
|
|
146
|
+
if operator.value in ("!=", "<>"):
|
|
147
|
+
return f"NOT {left} LIKE {right}"
|
|
148
|
+
if operator.value in ("NOT LIKE"):
|
|
149
|
+
return f"NOT {left} LIKE {right}"
|
|
150
|
+
|
|
146
151
|
if flipAllowed and left.lower() >= right.lower():
|
|
147
152
|
left, right = right, left
|
|
148
153
|
if operator.value == ">":
|
sql_testing_tools-0.2.5/README.md → sql_testing_tools-0.2.7/sql_testing_tools.egg-info/PKG-INFO
RENAMED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: sql_testing_tools
|
|
3
|
+
Version: 0.2.7
|
|
4
|
+
Description-Content-Type: text/markdown
|
|
5
|
+
Requires-Dist: sqlparse>=0.5.1
|
|
6
|
+
Requires-Dist: requests>=2.32.3
|
|
7
|
+
Dynamic: description
|
|
8
|
+
Dynamic: description-content-type
|
|
9
|
+
Dynamic: requires-dist
|
|
10
|
+
|
|
1
11
|
A library that normalizes simple SQL queries and compares them first by equality of the normalized string and then using the cosette API.
|
|
2
12
|
|
|
3
13
|
#### [Beta in Development!]
|
|
@@ -126,6 +136,13 @@ res = checkEquality()
|
|
|
126
136
|
|
|
127
137
|
### Changelog
|
|
128
138
|
|
|
139
|
+
|
|
140
|
+
##### V 0.2.7
|
|
141
|
+
- Normalize String unequality: ...<>..., ...!=..., ...NOT LIKE... --> NOT...LIKE...
|
|
142
|
+
|
|
143
|
+
##### V 0.2.6
|
|
144
|
+
- Fixed bug in checkKeywords: if keyword was present in one query and not in the other, the comparison was not performed correctly.
|
|
145
|
+
|
|
129
146
|
##### V 0.2.5
|
|
130
147
|
- 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.
|
|
131
148
|
- Improved docs
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sql_testing_tools-0.2.5 → sql_testing_tools-0.2.7}/sql_testing_tools.egg-info/top_level.txt
RENAMED
|
File without changes
|