jsonsqlquery
Query JSON using SQL.
pip install jsonsqlquery
Examples
# students.jsonl
{"name": "Alvin", "age": 25, "major": "Literature"}
{"name": "Kathy", "age": 31, "major": "Literature"}
{"name": "Pauline", "age": 11, "major": "Mathematics"}
{"name": "Nora", "age": 27, "major": "Mathematics"}
{"name": "Martin", "age": 54, "major": "Geology"}
Inline SQL query:
cat students.jsonl | jsonsqlquery --query 'select name, age from data where age > 30'
SQL query from a file:
cat students.jsonl | jsonsqlquery --query-file query.sql
Create a SQLite database:
cat students.jsonl | jsonsqlquery --create-db students.db
Python API:
import jsonsqlquery
students = [...]
older_students = jsonsqlquery.query(students, "select name, age from data where age > 30")
Caveats
- Booleans are cast to integers.
- Data is assumed to fit in memory.
Metadata
Release files for jsonsqlquery 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jsonsqlquery-0.1.2.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonsqlquery-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / jsonsqlquery-0.1.2.tar.gz
| Download URL | jsonsqlquery-0.1.2.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfa366b95ba87a00d49ace1066761d97a43fedab6026dc3ea3d6b954ec47feef
|
|
BLAKE2b-256 checksum How to use checksums |
79733382dce1403d2d4cbec01b84473ed90bdcfabdb13523dbb1852bc6434860
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.6 Darwin/22.3.0
|
Release files / jsonsqlquery-0.1.2-py3-none-any.whl
| Download URL | jsonsqlquery-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f3dda19d66eb4922024b4decb652534a530cda9298fe737d8db74d4cb3a0ac1
|
|
BLAKE2b-256 checksum How to use checksums |
40de150db61d4ad16dad5fd6533952addca2547645de8b76fdcd9aa7cef40222
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.6 Darwin/22.3.0
|