sql-testing-tools 0.2.0__tar.gz → 0.2.1__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.0 → sql_testing_tools-0.2.1}/PKG-INFO +6 -3
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/README.md +6 -3
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/setup.py +2 -2
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools/Helper.py +5 -1
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools/TokenProcessing.py +2 -26
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools.egg-info/PKG-INFO +6 -3
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/setup.cfg +0 -0
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools/BaseAccess.py +0 -0
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools/__init__.py +0 -0
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools.egg-info/SOURCES.txt +0 -0
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools.egg-info/dependency_links.txt +0 -0
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools.egg-info/requires.txt +0 -0
- {sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/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.1
|
|
4
4
|
Description-Content-Type: text/markdown
|
|
5
5
|
Requires-Dist: sqlparse>=0.5.1
|
|
6
6
|
Requires-Dist: requests>=2.32.3
|
|
@@ -15,6 +15,9 @@ A library that normalizes simple SQL queries and compares them first by equality
|
|
|
15
15
|
[](https://github.com/ValentinHerrmann/sql_testing_tools/actions/workflows/python-build.yml)
|
|
16
16
|
[](https://github.com/ValentinHerrmann/sql_testing_tools/actions/workflows/python-unittests.yml)
|
|
17
17
|
|
|
18
|
+
### V 0.2.1
|
|
19
|
+
- Support LIMIT
|
|
20
|
+
|
|
18
21
|
### V 0.1.9 + 0.2.0
|
|
19
22
|
- Support ORDER BY
|
|
20
23
|
|
|
@@ -22,10 +25,9 @@ A library that normalizes simple SQL queries and compares them first by equality
|
|
|
22
25
|
- Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
|
|
23
26
|
|
|
24
27
|
### V 0.1.6 + V 0.1.7
|
|
25
|
-
- Fixed import error to ensure imports working in different
|
|
28
|
+
- Fixed import error to ensure imports working in different environments
|
|
26
29
|
|
|
27
30
|
### V 0.1.4 + V 0.1.5
|
|
28
|
-
- V0.1.5 is just a reupload of V 0.1.4
|
|
29
31
|
- Chained conditions (with AND,OR and Paranthesises) in WHERE statement
|
|
30
32
|
|
|
31
33
|
### V 0.1.3
|
|
@@ -33,3 +35,4 @@ A library that normalizes simple SQL queries and compares them first by equality
|
|
|
33
35
|
- FROM: one or more table from DB; no queries as tables!
|
|
34
36
|
- WHERE: single conditions; no Paranthesises!
|
|
35
37
|
- GROUP BY one or more columns
|
|
38
|
+
|
|
@@ -5,6 +5,9 @@ A library that normalizes simple SQL queries and compares them first by equality
|
|
|
5
5
|
[](https://github.com/ValentinHerrmann/sql_testing_tools/actions/workflows/python-build.yml)
|
|
6
6
|
[](https://github.com/ValentinHerrmann/sql_testing_tools/actions/workflows/python-unittests.yml)
|
|
7
7
|
|
|
8
|
+
### V 0.2.1
|
|
9
|
+
- Support LIMIT
|
|
10
|
+
|
|
8
11
|
### V 0.1.9 + 0.2.0
|
|
9
12
|
- Support ORDER BY
|
|
10
13
|
|
|
@@ -12,14 +15,14 @@ A library that normalizes simple SQL queries and compares them first by equality
|
|
|
12
15
|
- Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
|
|
13
16
|
|
|
14
17
|
### V 0.1.6 + V 0.1.7
|
|
15
|
-
- Fixed import error to ensure imports working in different
|
|
18
|
+
- Fixed import error to ensure imports working in different environments
|
|
16
19
|
|
|
17
20
|
### V 0.1.4 + V 0.1.5
|
|
18
|
-
- V0.1.5 is just a reupload of V 0.1.4
|
|
19
21
|
- Chained conditions (with AND,OR and Paranthesises) in WHERE statement
|
|
20
22
|
|
|
21
23
|
### V 0.1.3
|
|
22
24
|
- SELECT: columns with our without table prefix
|
|
23
25
|
- FROM: one or more table from DB; no queries as tables!
|
|
24
26
|
- WHERE: single conditions; no Paranthesises!
|
|
25
|
-
- GROUP BY one or more columns
|
|
27
|
+
- GROUP BY one or more columns
|
|
28
|
+
|
|
@@ -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.
|
|
9
|
+
version='0.2.1',
|
|
10
10
|
packages=find_packages(),
|
|
11
11
|
install_requires=[
|
|
12
12
|
'sqlparse>=0.5.1',
|
|
@@ -14,4 +14,4 @@ setup(
|
|
|
14
14
|
],
|
|
15
15
|
long_description=description,
|
|
16
16
|
long_description_content_type="text/markdown"
|
|
17
|
-
)
|
|
17
|
+
)
|
|
@@ -41,7 +41,7 @@ def normalizeSQLQuery(query, baseDict):
|
|
|
41
41
|
|
|
42
42
|
formatted_query = []
|
|
43
43
|
|
|
44
|
-
# Second pass to process SELECT, WHERE, GROUP BY,
|
|
44
|
+
# Second pass to process SELECT, WHERE, GROUP BY, ORDER BY, and LIMIT clauses
|
|
45
45
|
for token in parsed.tokens:
|
|
46
46
|
if token.is_whitespace:
|
|
47
47
|
continue
|
|
@@ -53,6 +53,8 @@ def normalizeSQLQuery(query, baseDict):
|
|
|
53
53
|
formatted_query.append('GROUP BY')
|
|
54
54
|
elif token.ttype is Keyword and token.value.upper() == 'ORDER BY':
|
|
55
55
|
formatted_query.append('ORDER BY')
|
|
56
|
+
elif token.ttype is Keyword and token.value.upper() == 'LIMIT':
|
|
57
|
+
formatted_query.append('LIMIT')
|
|
56
58
|
elif (isinstance(token, IdentifierList) or isinstance(token, Identifier)) and formatted_query and formatted_query[-1] == 'FROM':
|
|
57
59
|
formatted_query.append(Tp._from(token, alias_map, baseDict))
|
|
58
60
|
elif (isinstance(token, IdentifierList) or isinstance(token, Identifier)) and formatted_query and formatted_query[-1] == 'GROUP BY':
|
|
@@ -66,6 +68,8 @@ def normalizeSQLQuery(query, baseDict):
|
|
|
66
68
|
if isinstance(token, Function):
|
|
67
69
|
token = IdentifierList([token])
|
|
68
70
|
formatted_query.append(Tp._select(token, alias_map, baseDict))
|
|
71
|
+
elif formatted_query and formatted_query[-1] == 'LIMIT':
|
|
72
|
+
formatted_query.append(Tp._limit(token))
|
|
69
73
|
else:
|
|
70
74
|
formatted_query.append(str(token))
|
|
71
75
|
|
|
@@ -341,29 +341,5 @@ def _where_twoConditionsOnTopLevel(where, alias_map, baseDict: dict, keyword, is
|
|
|
341
341
|
return keyword.join(current_condition)
|
|
342
342
|
|
|
343
343
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
# def _where_xx(where, alias_map, baseDict: dict):
|
|
347
|
-
# where_tokens = []
|
|
348
|
-
# for token in where.tokens:
|
|
349
|
-
|
|
350
|
-
# if isinstance(token, Comparison):
|
|
351
|
-
# left, operator, right = [t for t in token.tokens if not t.is_whitespace]
|
|
352
|
-
# left = _identifier(left, alias_map, baseDict)
|
|
353
|
-
# right = _identifier(right, alias_map, baseDict)
|
|
354
|
-
# if left.lower() >= right.lower():
|
|
355
|
-
# left, right = right, left
|
|
356
|
-
# if operator.value == ">":
|
|
357
|
-
# operator = "<"
|
|
358
|
-
# elif operator.value == "<":
|
|
359
|
-
# operator = ">"
|
|
360
|
-
|
|
361
|
-
# where_tokens.append(f"{left.lower()} {operator} {right.lower()}")
|
|
362
|
-
# elif token.ttype is Keyword:
|
|
363
|
-
# where_tokens.append(token.value.upper())
|
|
364
|
-
# elif token.is_whitespace or (token.ttype is Keyword and token.value.upper() == "WHERE"):
|
|
365
|
-
# continue
|
|
366
|
-
# else:
|
|
367
|
-
# where_tokens.append(str(token))
|
|
368
|
-
# return " ".join(where_tokens)
|
|
369
|
-
|
|
344
|
+
def _limit(limit):
|
|
345
|
+
return str(limit).strip()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: sql_testing_tools
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Description-Content-Type: text/markdown
|
|
5
5
|
Requires-Dist: sqlparse>=0.5.1
|
|
6
6
|
Requires-Dist: requests>=2.32.3
|
|
@@ -15,6 +15,9 @@ A library that normalizes simple SQL queries and compares them first by equality
|
|
|
15
15
|
[](https://github.com/ValentinHerrmann/sql_testing_tools/actions/workflows/python-build.yml)
|
|
16
16
|
[](https://github.com/ValentinHerrmann/sql_testing_tools/actions/workflows/python-unittests.yml)
|
|
17
17
|
|
|
18
|
+
### V 0.2.1
|
|
19
|
+
- Support LIMIT
|
|
20
|
+
|
|
18
21
|
### V 0.1.9 + 0.2.0
|
|
19
22
|
- Support ORDER BY
|
|
20
23
|
|
|
@@ -22,10 +25,9 @@ A library that normalizes simple SQL queries and compares them first by equality
|
|
|
22
25
|
- Fixed linebreak problems: Linebreaks are now converted into whitespaces before parsing where tokens
|
|
23
26
|
|
|
24
27
|
### V 0.1.6 + V 0.1.7
|
|
25
|
-
- Fixed import error to ensure imports working in different
|
|
28
|
+
- Fixed import error to ensure imports working in different environments
|
|
26
29
|
|
|
27
30
|
### V 0.1.4 + V 0.1.5
|
|
28
|
-
- V0.1.5 is just a reupload of V 0.1.4
|
|
29
31
|
- Chained conditions (with AND,OR and Paranthesises) in WHERE statement
|
|
30
32
|
|
|
31
33
|
### V 0.1.3
|
|
@@ -33,3 +35,4 @@ A library that normalizes simple SQL queries and compares them first by equality
|
|
|
33
35
|
- FROM: one or more table from DB; no queries as tables!
|
|
34
36
|
- WHERE: single conditions; no Paranthesises!
|
|
35
37
|
- GROUP BY one or more columns
|
|
38
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sql_testing_tools-0.2.0 → sql_testing_tools-0.2.1}/sql_testing_tools.egg-info/top_level.txt
RENAMED
|
File without changes
|