JSON to SQL query generator
Project description
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.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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jsqlib-0.10a0.tar.gz.
File metadata
- Download URL: jsqlib-0.10a0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.9 Linux/5.15.154+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4129da83dafe17fd5f1e3bffd57db7cb601b24940d1910ee8be3eb0c3d70d84
|
|
| MD5 |
144e071e2fdbdab637cf60785b9c9c51
|
|
| BLAKE2b-256 |
bf4586ea0b8bfc3ab2255c4ba8a5c759c0fcbb8977a36fb3d24f81dde56d1c48
|
File details
Details for the file jsqlib-0.10a0-py3-none-any.whl.
File metadata
- Download URL: jsqlib-0.10a0-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.9 Linux/5.15.154+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24b07a7ef30c8da908e96ed38aaacf305cdec2dfe8a8db055d3d3e254d747bb5
|
|
| MD5 |
192ece25c42a2650bf5d3b0c8a559375
|
|
| BLAKE2b-256 |
8be8859a33f0a7b773649d8c08d7104443293d27b5d9840cbdcdc4b73105ee0c
|