Registry / database / presto-types-parser

presto-types-parser

JSON →
library0.0.2pypypi✓ verified 85d ago

`presto-types-parser` is a small Python library designed to parse and convert input rows returned by the Presto REST API according to their specified Presto data types. It ensures that data structures like arrays, maps, and rows, as well as primitive types, are correctly interpreted into Python equivalents. The current version is 0.0.2, and it appears to have a very slow release cadence with only one public release.

pip install presto-types-parser
INSTALL
IMPORT
SIG · PRESTO-TYPES-PARSE
P
presto-types-parser
databasepythonv0.0.2
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

build_row_parser
from presto_types_parser import build_row_parser
from presto_types_parser import parse_presto_rows

This example demonstrates how to parse a list of Presto-style rows using a corresponding list of Presto type strings. The function converts the raw input into native Python types based on the schema.

from presto_types_parser import parse_presto_rows rows = [[1, 'value_a', True], [2, 'value_b', False], [3, None, True]] types = ['INTEGER', 'VARCHAR', 'BOOLEAN'] parsed_data = parse_presto_rows(rows, types) print(parsed_data) # Expected output: # [[1, 'value_a', True], [2, 'value_b', False], [3, None, True]]
Debug
Known issues
gotchaThe parser expects input rows and types to strictly adhere to the Presto API's format. Any mismatch in the number of values per row versus the number of provided types, or malformed complex type strings (e.g., `ARRAY<VARCHAR>`), will lead to parsing errors or incorrect output.
fix
Thoroughly validate the structure of `rows` (list of lists) and `types` (list of Presto type strings) against your Presto query's output schema before passing them to the parser.
affects: 0.0.1 - 0.0.2
gotchaError messages for complex or deeply nested type mismatches might be generic. Debugging issues with `ARRAY`, `MAP`, or `ROW` types may require manual inspection of the input data and type definitions.
fix
For complex types, test with simpler inputs first. Break down nested structures to identify the exact point of failure. Ensure JSON strings within `JSON` types are valid.
affects: 0.0.1 - 0.0.2
Upgrade
Version history
0.0.2latest on PyPI · released Aug 18, 2020
Audit
Dependencies
typing_extensionsrequiredRequired for type hint compatibility, especially on older Python versions.
Agent activity
9 hits · last 30 days
node
6
Resources
presto-types-parser — pip install presto-types-parser · libregistry