Skip to main content

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

parser = DynamoDBStatementParser(source_data={"table1": {"a1": {"S": "b1"}, "a2": {"S": "b2"}}})
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 cannot select key for each document in the list)
  • select values is not supported

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_partiql_parser-0.5.6.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

py_partiql_parser-0.5.6-py2.py3-none-any.whl (23.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file py_partiql_parser-0.5.6.tar.gz.

File metadata

  • Download URL: py_partiql_parser-0.5.6.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for py_partiql_parser-0.5.6.tar.gz
Algorithm Hash digest
SHA256 6339f6bf85573a35686529fc3f491302e71dd091711dfe8df3be89a93767f97b
MD5 1da1951bd65f95628bbd520119391f12
BLAKE2b-256 de919d499c960abea0efda9e81aa62bd8dd1eab1daa12db9b3b0064fe2f8b3c7

See more details on using hashes here.

File details

Details for the file py_partiql_parser-0.5.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for py_partiql_parser-0.5.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 622d7b0444becd08c1f4e9e73b31690f4b1c309ab6e5ed45bf607fe71319309f
MD5 c69fa405a3098f743a73e4c0d9efa193
BLAKE2b-256 2c2446262d45ee9e54a181c440fe1a3d87fd538d69f10c8311f699e555119d1f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page