JakobGM / patito

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

Support for polars Date and Datetime types #21

Closed dentesure closed 11 months ago

dentesure commented 11 months ago

Great package. Unfortunately I work with time series data a lot (example) below and I am getting a runtime error like:

RuntimeError: no validator found for <class '__main__.PolarsDate'>, see `arbitrary_types_allowed` in Config

Example

from polars import DataFrame, Datetime, Date

@validate_arguments(config=dict(arbitrary_types_allowed=True))
class ScoresTable(pt.Model):
    id: int = pt.Field(ge=0, unique=True)
    local_date: Date
    utc_dt: Datetime(time_unit='us', time_zone='UTC')
    values: float
thomasaarholt commented 11 months ago

Just checking if there was a particular reason you closed this?