Pure Python PartiQL Parser
Project description
py-partiql-parser
A tokenizer/parser/executor for the PartiQL-language, in Python.
Much beta, such wow. Feel free to raise any issues you encounter.
S3 Usage
import json
from py_partiql_parser import S3SelectParser
original_json = json.dumps({"a1": "b1", "a2": "b2"})
parser = S3SelectParser(source_data={"s3object": original_json})
result = parser.parse("SELECT * FROM s3object")
DynamoDB Usage
import json
from py_partiql_parser import DynamoDBStatementParser
original_json = json.dumps({"a1": "b1", "a2": "b2"})
parser = DynamoDBStatementParser(source_data={"table1", original_json})
result = parser.parse("SELECT * from table1 WHERE a1 = ?", parameters=[{"S": "b1"}])
Meat
The important logic of this library can be found here: https://github.com/bblommers/py-partiql-parser/blob/main/py_partiql_parser/_internal/parser.py
It is implemented as a naive, dependency-free, TDD-first tokenizer.
Outstanding
- Support for functions such as
count(*)
- Support for CSV conversion. A start has been made in
_internal/csv_converter.py
- .. and I'm sure many other things.
Notes
The first iteration of this library was based on the spec, found here: https://partiql.org/assets/PartiQL-Specification.pdf
AWS doesn't follow its own spec though, most notably:
- a file containing a list (with multiple JSON documents) cannot be queried normally (
select *
returns everything, but you cannotselect key
for each document in the list) select values
is not supported
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
File details
Details for the file py-partiql-parser-0.3.7.tar.gz
.
File metadata
- Download URL: py-partiql-parser-0.3.7.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5341f1adc3bdd5dbe7c980fc17b3a4a6353c9052e5b5dd70f6aff9306fb8cbb2 |
|
MD5 | ac03cc41640963fa00c8c50085869e64 |
|
BLAKE2b-256 | 1683805b2e2263ba8733e8b84c10e484245cf9ed53808b392ced2ab8847bb76c |
File details
Details for the file py_partiql_parser-0.3.7-py3-none-any.whl
.
File metadata
- Download URL: py_partiql_parser-0.3.7-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e18696b40b9733b1e4b312969f8210fcde24e0766e2a0da799e8f70a5594d6ab |
|
MD5 | bd412b26452b82e4e34eb1f4a1d02d5f |
|
BLAKE2b-256 | 9de50967cf421d386bdadf624180917f6d64ec0802a255046d7c4ee3b6b3a520 |