Py PartiQL Parser

0.6.3 · active · verified Sun Apr 05

py-partiql-parser is a pure Python tokenizer, parser, and executor for the PartiQL language. PartiQL is an expressive, SQL-compatible query language for relational, semi-structured, and nested data, primarily maintained by Amazon. The library is currently at version 0.6.3 and appears to be actively maintained, with releases indicating ongoing development, though without a fixed cadence.

Warnings

Install

Imports

Quickstart

This example demonstrates how to parse a PartiQL statement into an Abstract Syntax Tree (AST) and then execute it against an in-memory Python list of dictionaries using the built-in executor.

from py_partiql_parser import DynamoDBStatementParser

# Instantiate the parser
parser = DynamoDBStatementParser()

# PartiQL statement to parse
statement = "select * from my_table where id = '123'"

# Parse the statement to get the Abstract Syntax Tree (AST)
parsed_ast = parser.parse(statement)
print(f"Parsed AST: {parsed_ast}")

# You can also execute the parsed statement with an in-memory dataset
data = [{"id": "123", "name": "foo"}, {"id": "456", "name": "bar"}]
result = parsed_ast.execute(data)
print(f"Execution result: {result}")

view raw JSON →