{"id":10060,"library":"presto-types-parser","title":"Presto Types Parser","description":"`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.","status":"active","version":"0.0.2","language":"en","source_language":"en","source_url":"https://github.com/ofekby/presto-types-parser","tags":["presto","data-parsing","data-types","database","sql"],"install":[{"cmd":"pip install presto-types-parser","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for type hint compatibility, especially on older Python versions.","package":"typing_extensions","optional":false}],"imports":[{"symbol":"parse_presto_rows","correct":"from presto_types_parser import parse_presto_rows"},{"symbol":"parse_presto_rows_with_names","correct":"from presto_types_parser import parse_presto_rows_with_names"}],"quickstart":{"code":"from presto_types_parser import parse_presto_rows\n\nrows = [[1, 'value_a', True], [2, 'value_b', False], [3, None, True]]\ntypes = ['INTEGER', 'VARCHAR', 'BOOLEAN']\n\nparsed_data = parse_presto_rows(rows, types)\nprint(parsed_data)\n# Expected output:\n# [[1, 'value_a', True], [2, 'value_b', False], [3, None, True]]","lang":"python","description":"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."},"warnings":[{"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.","message":"The 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.","severity":"gotcha","affected_versions":"0.0.1 - 0.0.2"},{"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.","message":"Error 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.","severity":"gotcha","affected_versions":"0.0.1 - 0.0.2"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure that `len(row)` is equal to `len(types)` for every `row` in your `rows` list. For nested types, verify that the data structure in the `rows` matches the declared type (e.g., a list for `ARRAY<...>`, a dictionary for `MAP<...>`).","cause":"The number of values in a row did not match the number of types specified, or a nested array/map structure within a row was malformed.","error":"IndexError: list index out of range"},{"fix":"Double-check the spelling of all type strings in your `types` list. Only standard Presto types like `INTEGER`, `VARCHAR`, `BOOLEAN`, `DOUBLE`, `ARRAY<...>`, `MAP<...>`, `ROW<...>`, `JSON` are supported. Refer to Presto documentation for valid type names.","cause":"An unsupported or misspelled Presto type string was provided in the `types` list.","error":"KeyError: 'UNKNOWN_TYPE'"}]}