py-partiql-parser

Pure Python PartiQL Parser

MIT 27 个版本
安装
pip install py-partiql-parser
poetry add py-partiql-parser
pipenv install py-partiql-parser
conda install py-partiql-parser
描述

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.

版本列表
0.6.3 2025-10-18
0.6.2 2025-10-15
0.6.1 2024-12-25
0.6.0 2024-12-25
0.5.6 2024-09-06
0.5.5 2024-05-11
0.5.4 2024-04-05
0.5.3 2024-04-05
0.5.2 2024-03-23
0.5.1 2024-02-01
0.5.0 2023-12-17
0.4.2 2023-10-29
0.4.1 2023-10-22
0.4.0 2023-10-15
0.3.8 2023-10-05
0.3.7 2023-08-01
0.3.6 2023-07-30
0.3.5 2023-07-19
0.3.4 2023-06-13
0.3.3 2023-05-29
0.3.2 2023-05-28
0.3.1 2023-05-25
0.3.0 2023-04-16
0.2.1 2023-04-13
0.2.0 2023-04-13
0.1.0 2023-03-20
0.0.1 2023-03-19