JakobGM / patito

A data modelling layer built on top of polars and pydantic
MIT License
270 stars 23 forks source link

RuntimeError: BindingsError: "Value(\"serialize not supported for this 'opaque' function\")" #17

Closed ion-elgreco closed 12 months ago

ion-elgreco commented 12 months ago

I get this error when I import a class with a custom constraint using a struct that got this inherited from another class.

Reproducible with:

class Test(pt.Model):
    id: int = pt.Field(constraints=pl.struct("id", "line_id").is_unique())
    line_id: int = pt.Field(dtype=pl.UInt32)

class TestExtraField(Test):
    extra_field: str

Reproducible with:

import copy
import patito as pt

copy.deepcopy(pl.struct("id", "line_id").is_unique())
ion-elgreco commented 12 months ago

Since it's related to Polars struct not being serializable, I've created a issue upstream: https://github.com/pola-rs/polars/issues/11100