trino-python-client
trino-python-client copied to clipboard
`NamedRowTuple` does not support pickling
Expected behavior
The custom type NamedRowTuple
does not implement the methods necessary for a successful pickle
roundtrip. When unpickling (pickle.load[s]
) it raises a TypeError
.
It should work with pickle
.
Some frameworks, for example https://github.com/streamlit/streamlit rely on pickling results/rows for caching which currently fails when using this library.
Actual behavior
Exception when calling pickle.load[s]
:
TypeError: NamedRowTuple.__new__() missing 2 required positional arguments: 'names' and 'types'
Steps To Reproduce
import pickle
from trino import types
pickle.loads(pickle.dumps(types.NamedRowTuple(["Alice", 38], ["name", "age"], ["varchar", "integer"])))
Log output
No response
Operating System
Linux
Trino Python client version
caff0e8c1b8c7d7c9e372b480b4efddf0418d350
Trino Server version
461
Python version
Python 3.12.5
Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!