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.
Usage
original_json = {"a1": "b1", "a2": "b2"}
from py_partiql_parser import Parser
parser = Parser(source_data={"s3object": original_json})
result = parser.parse("SELECT * FROM s3object")
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.
Tests
Tests based on real-world examples from users/AWS, and can be found here: https://github.com/getmoto/py-partiql-parser/blob/main/tests/test_aws_examples.py
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
Hashes for py_partiql_parser-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bea5642d5f2788c47f65ac93974b824072e860d2cbb92ef64d41de9e8c9a6b2 |
|
MD5 | 7917c65501f55be091fe1c74fc77524f |
|
BLAKE2b-256 | a9b34363f8a52e8d925f2951e98860eae43e79050ea8af210a169e613aea2f34 |