This release is a pre-release and may not be stable for production use.
jsqlib
JSON to SQL query generator.
Builds SQL queries from pre-designed JSON structures.
Installation
OS X & Linux & Windows:
pip install jsqlib
Usage example
from jsqlib import Query
json = """{
"query": {
"select": [
{
"eval": 1
}
]
}
}
"""
query = Query(json)
assert query.sql == 'select 1'
schema = '{}'
query = Query(json, schema=schema) # optional schema to validate the query
query.validate() # explicit query validation
Development setup
- coverage
poetry run pytest --cov
- format
poetry run black jsqlib -S
- lint
poetry run ruff check
- type checking
poetry run pyre
Release History
- 0.12a0
- FIX: identifier/literal injection via unescaped quote in _quote() (#44)
- 0.11a0
- ADD: postgresql
in (values (),...)support (#43)
- ADD: postgresql
- 0.10a0
- ADD: postgresql pattern matching support (#39)
- 0.9a0
- CHANGE: python-box library updated to version 7 (#28)
- CHANGE: sqlfluff library updated to version 3. Warning: query.prettify output may change. (#34)
- CHANGE: python 3.12 support (#35)
- 0.8a0
- CHANGE: nested
selectininsert from selectstatement (#31)
- CHANGE: nested
- 0.7a0
- ADD:
<~~>unquoting wrapper support (#29)
- ADD:
- 0.6a0
- CHANGE: validating the rendered json query against the provided schema without any changes (#26)
- 0.5a0
- FIX: local variable 'data' referenced before assignment in Builder._update (#18)
- ADD: support for a
nameattribute in JSONselectdefinition (#20) - ADD: validating JSON query against a schema if any (#19)
- 0.4a0
- FIX:
order byimplicitascconstruct (#16) - CHANGE: library no longer modifies the original json query (#15)
- ADD:
__version__package attribute (#14)
- FIX:
- 0.3a0
- ADD:
not like,deleteusingconstructs (#12, #13)
- ADD:
- 0.2a0
- ADD: dialect based stringification (#11)
- ADD: custom builder support (#10)
- 0.1a0
- initial alpha-release
- 0.0.1
- wip
Meta
pymancer@gmail.com (Polyanalitika LLC)
https://gitlab.com/ru-r5/jsqlib
License
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
Contributing
- Fork it (https://gitlab.com/ru-r5/jsqlib/fork)
- Create your feature branch (
git checkout -b feature/foo) - Commit your changes (
git commit -am 'Add some foo') - Push to the branch (
git push origin feature/foo) - Create a new Pull Request
Metadata
Release files for jsqlib 0.12a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsqlib-0.12a0.tar.gz | 11.2 kB | Without provenance | Details for jsqlib-0.12a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsqlib-0.12a0-py3-none-any.whl | Python 3 | none | any | Details for jsqlib-0.12a0-py3-none-any.whl |
Total release size: 23.9 kB
Release files / jsqlib-0.12a0.tar.gz
| Download URL | jsqlib-0.12a0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
efb023cc3e869c833ae336680c12b4694f80589d583162ce2b2f1a824fdd5556
|
|
BLAKE2b-256 checksum How to use checksums |
126d54e2ec86f45c6a74b2caac50757f1588bc5722fd08793505887105ad4502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.14 Linux/5.15.154+
|
Release files / jsqlib-0.12a0-py3-none-any.whl
| Download URL | jsqlib-0.12a0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ee9a731eb4aba0d27764f8a557bafb1ff41b51eb816510cdb626a73311ceebc
|
|
BLAKE2b-256 checksum How to use checksums |
35c7c6467a680f3c9198918b7080cb0921ee126d735c51e30115e8ee51cd0885
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.14 Linux/5.15.154+
|
Security for jsqlib 0.12a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.