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.

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 cannot select key for each document in the list)
  • select values is not supported

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

Uploaded Source

Built Distribution

py_partiql_parser-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file py-partiql-parser-0.1.0.tar.gz.

File metadata

  • Download URL: py-partiql-parser-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for py-partiql-parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03ef60b871ee341204775201918b27da611b7b0ddfa63688ca393d5ea8ed2a26
MD5 7125bc53317759f1fc6045af66641626
BLAKE2b-256 688f7b37ff6ca28c3f335dd50b4cbb7f4e26c60f16ebd7d89011def96a9354e3

See more details on using hashes here.

File details

Details for the file py_partiql_parser-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for py_partiql_parser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 daaa5902a32b3161b057bd94b86768a282703ccc03b73f3a85c5f5888dd5b88c
MD5 e105ba127258b57c98d952033548866c
BLAKE2b-256 ecb7e5f62b93bc73f416df83d018d133aefe3330b8aaa37f9b291da65fe3b258

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