jsqlib 0.8a0__tar.gz → 0.10a0__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.
- {jsqlib-0.8a0 → jsqlib-0.10a0}/PKG-INFO +14 -8
- {jsqlib-0.8a0 → jsqlib-0.10a0}/README.md +7 -1
- {jsqlib-0.8a0 → jsqlib-0.10a0}/jsqlib/__init__.py +1 -2
- {jsqlib-0.8a0 → jsqlib-0.10a0}/jsqlib/core.py +4 -0
- {jsqlib-0.8a0 → jsqlib-0.10a0}/jsqlib/engine.py +8 -3
- {jsqlib-0.8a0 → jsqlib-0.10a0}/jsqlib/helpers/common.py +2 -1
- {jsqlib-0.8a0 → jsqlib-0.10a0}/jsqlib/helpers/constants.py +1 -0
- {jsqlib-0.8a0 → jsqlib-0.10a0}/jsqlib/helpers/types.py +1 -0
- jsqlib-0.10a0/pyproject.toml +76 -0
- jsqlib-0.8a0/pyproject.toml +0 -97
- {jsqlib-0.8a0 → jsqlib-0.10a0}/jsqlib/helpers/__init__.py +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: jsqlib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10a0
|
|
4
4
|
Summary: JSON to SQL query generator
|
|
5
|
-
Home-page: https://gitlab.com/ru-r5/jsqlib
|
|
6
5
|
License: MPL-2.0
|
|
7
6
|
Keywords: sql,json
|
|
8
7
|
Author: pymancer
|
|
9
8
|
Author-email: pymancer@gmail.com
|
|
10
|
-
Requires-Python: >=3.9,<
|
|
9
|
+
Requires-Python: >=3.9,<3.13
|
|
11
10
|
Classifier: Development Status :: 3 - Alpha
|
|
12
11
|
Classifier: Environment :: Console
|
|
13
12
|
Classifier: Intended Audience :: Information Technology
|
|
@@ -21,10 +20,11 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Topic :: Database
|
|
23
22
|
Classifier: Topic :: Software Development :: Libraries
|
|
24
|
-
Requires-Dist: jsonschema (>=4
|
|
25
|
-
Requires-Dist: python-box (>=5
|
|
26
|
-
Requires-Dist: sqlfluff (>=
|
|
23
|
+
Requires-Dist: jsonschema (>=4,<5)
|
|
24
|
+
Requires-Dist: python-box (>=5,<8)
|
|
25
|
+
Requires-Dist: sqlfluff (>=3,<4)
|
|
27
26
|
Project-URL: Documentation, https://gitlab.com/ru-r5/jsqlib/-/wikis/home
|
|
27
|
+
Project-URL: Homepage, https://gitlab.com/ru-r5/jsqlib
|
|
28
28
|
Project-URL: Repository, https://gitlab.com/ru-r5/jsqlib
|
|
29
29
|
Description-Content-Type: text/markdown
|
|
30
30
|
|
|
@@ -86,7 +86,7 @@ $ poetry run black jsqlib -S
|
|
|
86
86
|
- lint
|
|
87
87
|
|
|
88
88
|
```sh
|
|
89
|
-
$ poetry run
|
|
89
|
+
$ poetry run ruff check
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
- type checking
|
|
@@ -96,6 +96,12 @@ $ poetry run pyre
|
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
## Release History
|
|
99
|
+
- 0.10a0
|
|
100
|
+
- ADD: postgresql pattern matching support (#39)
|
|
101
|
+
- 0.9a0
|
|
102
|
+
- CHANGE: python-box library updated to version 7 (#28)
|
|
103
|
+
- CHANGE: sqlfluff library updated to version 3. Warning: query.prettify output may change. (#34)
|
|
104
|
+
- CHANGE: python 3.12 support (#35)
|
|
99
105
|
- 0.8a0
|
|
100
106
|
- CHANGE: nested `select` in `insert from select` statement (#31)
|
|
101
107
|
- 0.7a0
|
|
@@ -56,7 +56,7 @@ $ poetry run black jsqlib -S
|
|
|
56
56
|
- lint
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
|
-
$ poetry run
|
|
59
|
+
$ poetry run ruff check
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
- type checking
|
|
@@ -66,6 +66,12 @@ $ poetry run pyre
|
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
## Release History
|
|
69
|
+
- 0.10a0
|
|
70
|
+
- ADD: postgresql pattern matching support (#39)
|
|
71
|
+
- 0.9a0
|
|
72
|
+
- CHANGE: python-box library updated to version 7 (#28)
|
|
73
|
+
- CHANGE: sqlfluff library updated to version 3. Warning: query.prettify output may change. (#34)
|
|
74
|
+
- CHANGE: python 3.12 support (#35)
|
|
69
75
|
- 0.8a0
|
|
70
76
|
- CHANGE: nested `select` in `insert from select` statement (#31)
|
|
71
77
|
- 0.7a0
|
|
@@ -6,6 +6,7 @@ Created on Aug 10, 2021
|
|
|
6
6
|
|
|
7
7
|
@author: pymancer@gmail.com (polyanalitika.ru)
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
from __future__ import annotations
|
|
10
11
|
|
|
11
12
|
from abc import ABCMeta
|
|
@@ -308,6 +309,9 @@ class Builder(metaclass=ABCMeta):
|
|
|
308
309
|
def _gte(self, value: List[SCBND_T]) -> str:
|
|
309
310
|
return self._commute_(value, op='>=')
|
|
310
311
|
|
|
312
|
+
def _pattern(self, value: List[SCBND_T]) -> str:
|
|
313
|
+
return self._commute_(value, op='~')
|
|
314
|
+
|
|
311
315
|
def _is(self, value: List[SCBND_T], negate: bool = False) -> str:
|
|
312
316
|
condition = 'is not' if negate else 'is'
|
|
313
317
|
return f'{self._eval_(value[0])} {condition} {self._eval_(value[-1])}'
|
|
@@ -6,6 +6,7 @@ Created on Jul 29, 2021
|
|
|
6
6
|
|
|
7
7
|
@author: pymancer@gmail.com (polyanalitika.ru)
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
import json
|
|
10
11
|
import sqlfluff
|
|
11
12
|
|
|
@@ -88,10 +89,14 @@ class Query:
|
|
|
88
89
|
if not isinstance(schema, dict):
|
|
89
90
|
schema = True
|
|
90
91
|
|
|
91
|
-
return validator_for(schema)(schema)
|
|
92
|
+
return validator_for(schema)(schema) # pyre-ignore[20]
|
|
92
93
|
|
|
93
94
|
def prettify(
|
|
94
|
-
self,
|
|
95
|
+
self,
|
|
96
|
+
sql: Optional[str] = None,
|
|
97
|
+
dialect: Optional[str] = None,
|
|
98
|
+
rules: Optional[List[str]] = None,
|
|
99
|
+
exclude_rules: Optional[List[str]] = None,
|
|
95
100
|
) -> str:
|
|
96
101
|
|
|
97
102
|
sql = sql or self.sql
|
|
@@ -105,7 +110,7 @@ class Query:
|
|
|
105
110
|
except KeyError:
|
|
106
111
|
dialect = 'ansi'
|
|
107
112
|
|
|
108
|
-
return sqlfluff.fix(sql, dialect=dialect, rules=rules) if sql else sql
|
|
113
|
+
return sqlfluff.fix(sql, dialect=dialect, rules=rules, exclude_rules=exclude_rules) if sql else sql
|
|
109
114
|
|
|
110
115
|
def _build(self, *args, **kwargs) -> str:
|
|
111
116
|
built = ''
|
|
@@ -6,6 +6,7 @@ Created on Aug 10, 2021
|
|
|
6
6
|
|
|
7
7
|
@author: pymancer@gmail.com (polyanalitika.ru)
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
from __future__ import annotations
|
|
10
11
|
|
|
11
12
|
from re import sub as resub
|
|
@@ -234,7 +235,7 @@ class Tokenizer:
|
|
|
234
235
|
false = self.translator.cast.false
|
|
235
236
|
null = self.translator.cast.null
|
|
236
237
|
|
|
237
|
-
if type_
|
|
238
|
+
if type_ is bool:
|
|
238
239
|
result = true if value else false
|
|
239
240
|
elif type_ == NoneType:
|
|
240
241
|
result = null
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "jsqlib"
|
|
3
|
+
version = "0.10a0"
|
|
4
|
+
license = "MPL-2.0"
|
|
5
|
+
description = "JSON to SQL query generator"
|
|
6
|
+
authors = ["pymancer <pymancer@gmail.com>"]
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
homepage = "https://gitlab.com/ru-r5/jsqlib"
|
|
9
|
+
repository = "https://gitlab.com/ru-r5/jsqlib"
|
|
10
|
+
documentation = "https://gitlab.com/ru-r5/jsqlib/-/wikis/home"
|
|
11
|
+
keywords = ["sql", "json"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Environment :: Console",
|
|
15
|
+
"Intended Audience :: Information Technology",
|
|
16
|
+
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Topic :: Database",
|
|
23
|
+
"Topic :: Software Development :: Libraries"
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[tool.poetry.dependencies]
|
|
27
|
+
python = ">=3.9,<3.13"
|
|
28
|
+
python-box = ">=5,<8"
|
|
29
|
+
sqlfluff = "^3"
|
|
30
|
+
jsonschema = "^4"
|
|
31
|
+
|
|
32
|
+
[tool.poetry.group.dev.dependencies]
|
|
33
|
+
black = "^24.0"
|
|
34
|
+
icecream = "^2.0"
|
|
35
|
+
pytest = "^8"
|
|
36
|
+
coverage = {extras = ["toml"], version = "^7"}
|
|
37
|
+
pytest-cov = "^5"
|
|
38
|
+
pre-commit = "^3"
|
|
39
|
+
ruff = "^0"
|
|
40
|
+
pyre-check = "^0.9"
|
|
41
|
+
|
|
42
|
+
[build-system]
|
|
43
|
+
requires = ["poetry-core"]
|
|
44
|
+
build-backend = "poetry.core.masonry.api"
|
|
45
|
+
|
|
46
|
+
[tool.pytest.ini_options]
|
|
47
|
+
minversion = "8.0"
|
|
48
|
+
addopts = "-q"
|
|
49
|
+
testpaths = ["tests"]
|
|
50
|
+
|
|
51
|
+
[tool.coverage.run]
|
|
52
|
+
source = ["jsqlib"]
|
|
53
|
+
|
|
54
|
+
[tool.coverage.report]
|
|
55
|
+
fail_under = 90
|
|
56
|
+
|
|
57
|
+
[tool.black]
|
|
58
|
+
line-length = 120
|
|
59
|
+
target-version = ['py312']
|
|
60
|
+
include = "jsqlib"
|
|
61
|
+
|
|
62
|
+
[tool.ruff]
|
|
63
|
+
line-length = 120
|
|
64
|
+
indent-width = 4
|
|
65
|
+
target-version = "py312"
|
|
66
|
+
exclude = [
|
|
67
|
+
'README.md',
|
|
68
|
+
'tests',
|
|
69
|
+
'.venv'
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[tool.ruff.lint]
|
|
73
|
+
ignore = ['E501']
|
|
74
|
+
|
|
75
|
+
[tool.ruff.lint.per-file-ignores]
|
|
76
|
+
"__init__.py" = ["E402"]
|
jsqlib-0.8a0/pyproject.toml
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
[tool.poetry]
|
|
2
|
-
name = "jsqlib"
|
|
3
|
-
version = "0"
|
|
4
|
-
license = "MPL-2.0"
|
|
5
|
-
description = "JSON to SQL query generator"
|
|
6
|
-
authors = ["pymancer <pymancer@gmail.com>"]
|
|
7
|
-
readme = "README.md"
|
|
8
|
-
homepage = "https://gitlab.com/ru-r5/jsqlib"
|
|
9
|
-
repository = "https://gitlab.com/ru-r5/jsqlib"
|
|
10
|
-
documentation = "https://gitlab.com/ru-r5/jsqlib/-/wikis/home"
|
|
11
|
-
keywords = ["sql", "json"]
|
|
12
|
-
classifiers = [
|
|
13
|
-
"Development Status :: 3 - Alpha",
|
|
14
|
-
"Environment :: Console",
|
|
15
|
-
"Intended Audience :: Information Technology",
|
|
16
|
-
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
|
|
17
|
-
"Operating System :: OS Independent",
|
|
18
|
-
"Programming Language :: Python :: 3.9",
|
|
19
|
-
"Topic :: Database",
|
|
20
|
-
"Topic :: Software Development :: Libraries"
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
[tool.poetry.dependencies]
|
|
24
|
-
python = "^3.9"
|
|
25
|
-
python-box = "^5.4"
|
|
26
|
-
sqlfluff = "^0.6"
|
|
27
|
-
jsonschema = "^4.0"
|
|
28
|
-
|
|
29
|
-
[tool.poetry.group.dev.dependencies]
|
|
30
|
-
black = "^22.3.0"
|
|
31
|
-
icecream = "^2.1.2"
|
|
32
|
-
|
|
33
|
-
[tool.poetry.dev-dependencies]
|
|
34
|
-
pytest = "^6"
|
|
35
|
-
coverage = {extras = ["toml"], version = "^5"}
|
|
36
|
-
pytest-cov = "^2"
|
|
37
|
-
pre-commit = "^2"
|
|
38
|
-
pylint = "^2"
|
|
39
|
-
flake8 = "^3"
|
|
40
|
-
flakehell = "^0.9"
|
|
41
|
-
pyre-check = "^0.9"
|
|
42
|
-
|
|
43
|
-
[build-system]
|
|
44
|
-
requires = ["setuptools", "poetry-core"]
|
|
45
|
-
build-backend = "poetry.core.masonry.api"
|
|
46
|
-
|
|
47
|
-
[tool.poetry-version-plugin]
|
|
48
|
-
source = "init"
|
|
49
|
-
|
|
50
|
-
[tool.pytest.ini_options]
|
|
51
|
-
minversion = "6.0"
|
|
52
|
-
addopts = "-q"
|
|
53
|
-
testpaths = ["tests"]
|
|
54
|
-
|
|
55
|
-
[tool.coverage.run]
|
|
56
|
-
source = ["jsqlib"]
|
|
57
|
-
|
|
58
|
-
[tool.coverage.report]
|
|
59
|
-
fail_under = 90
|
|
60
|
-
|
|
61
|
-
[tool.black]
|
|
62
|
-
line-length = 120
|
|
63
|
-
target-version = ['py39']
|
|
64
|
-
include = "jsqlib"
|
|
65
|
-
|
|
66
|
-
[tool.flakehell]
|
|
67
|
-
exclude = ["README.md", "tests/", ".venv/"]
|
|
68
|
-
format = "colored"
|
|
69
|
-
max_line_length = 120
|
|
70
|
-
show_source = true
|
|
71
|
-
extended_default_ignore=[]
|
|
72
|
-
|
|
73
|
-
[tool.flakehell.plugins]
|
|
74
|
-
flake8-bandit = ["+*", "-S322"]
|
|
75
|
-
flake8-bugbear = ["+*"]
|
|
76
|
-
flake8-builtins = ["+*"]
|
|
77
|
-
flake8-comprehensions = ["+*"]
|
|
78
|
-
flake8-darglint = ["+*"]
|
|
79
|
-
flake8-docstrings = ["+*"]
|
|
80
|
-
flake8-eradicate = ["+*"]
|
|
81
|
-
flake8-isort = ["+*"]
|
|
82
|
-
flake8-mutable = ["+*"]
|
|
83
|
-
flake8-pytest-style = ["+*"]
|
|
84
|
-
flake8-spellcheck = ["+*"]
|
|
85
|
-
pep8-naming = ["+*"]
|
|
86
|
-
pycodestyle = ["+*", "-E203", "-E501", "-W503"]
|
|
87
|
-
pyflakes = ["+*"]
|
|
88
|
-
pylint = ["+*"]
|
|
89
|
-
|
|
90
|
-
[tool.flakehell.exceptions."tests/"]
|
|
91
|
-
flake8-bandit = ["-*"]
|
|
92
|
-
pyflakes = ["-*"]
|
|
93
|
-
flake8-darglint = ["-*"]
|
|
94
|
-
flake8-docstrings = ["-*"]
|
|
95
|
-
|
|
96
|
-
[tool.flakehell.exceptions."jsqlib/__init__.py"]
|
|
97
|
-
pyflakes = ["-F401"]
|
|
File without changes
|