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.6.3.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_partiql_parser-0.6.3-py2.py3-none-any.whl (23.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: py_partiql_parser-0.6.3.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py_partiql_parser-0.6.3.tar.gz
Algorithm Hash digest
SHA256 09cecf916ce6e3da2c050f0cb6106166de42c33d34a078ec2eb19377ea70389a
MD5 eda762adf981e30ce575ce26dae9a4da
BLAKE2b-256 567aa0f6bda783eb4df8e3dfd55973a1ac6d368a89178c300e1b5b91cd181e5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_partiql_parser-0.6.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 deb0769c3346179d2f590dcbde556f708cdb929059fb654bad75f4cf6e07f582
MD5 0145a49bb90d5d4a4dfa058ca9c45d13
BLAKE2b-256 c933a7cbfccc39056a5cf8126b7aab4c8bafbedd4f0ca68ae40ecb627a2d2cd3

See more details on using hashes here.

Supported by

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