Skip to content

NamedRowTuple does not support pickling #490

@ragnard

Description

@ragnard

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions