Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NamedRowTuple does not support pickling #490

Open
1 task done
ragnard opened this issue Oct 15, 2024 · 0 comments · May be fixed by #491
Open
1 task done

NamedRowTuple does not support pickling #490

ragnard opened this issue Oct 15, 2024 · 0 comments · May be fixed by #491

Comments

@ragnard
Copy link
Member

ragnard commented Oct 15, 2024

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

caff0e8

Trino Server version

461

Python version

Python 3.12.5

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
ragnard added a commit to ragnard/trino-python-client that referenced this issue Oct 15, 2024
Previously `NamedRowTuple` did not roundtrip successfully.
Added tests for all custom types.
ragnard added a commit to ragnard/trino-python-client that referenced this issue Oct 15, 2024
Previously `NamedRowTuple` did not roundtrip successfully.
Added tests for all custom types.
ragnard added a commit to ragnard/trino-python-client that referenced this issue Oct 15, 2024
Previously `NamedRowTuple` did not roundtrip successfully.
Added tests for all custom types.
ragnard added a commit to ragnard/trino-python-client that referenced this issue Oct 15, 2024
Previously `NamedRowTuple` did not roundtrip successfully.
Added tests for all custom types.
ragnard added a commit to ragnard/trino-python-client that referenced this issue Oct 15, 2024
Previously `NamedRowTuple` did not roundtrip successfully.
Added tests for all custom types.

Fixes trinodb#490.
ragnard added a commit to ragnard/trino-python-client that referenced this issue Oct 15, 2024
Previously `NamedRowTuple` did not roundtrip successfully.
Added tests for all custom types.

Fixes trinodb#490.
@ragnard ragnard linked a pull request Oct 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant