Skip to content

[Enh]: Pydantic integration #3317

@danielgafni

Description

@danielgafni

We would like to learn about your use case. For example, if this feature is needed to adopt Narwhals in an open source project, could you please enter the link to it below?

https://anam-org.github.io/metaxy/main/

Please describe the purpose of the new feature or describe the problem to solve.

I would like to convert my Pydantic models into Narwhals schemas.
I am probably going to implement something myself right now, but I feel like this feature is general and useful enough to belong to Narwhals itself.

Suggest a solution if possible.

No response

If you have tried alternatives, please describe them below.

Something like https://github.com/FBruzzesi/anyschema, but staying in Narwhals land instead.

Additional information that may help us understand your needs.

I need to make sure DataFrames have the right schema before writing them to storage formats that support schema evolution (such as DeltaLake or LanceDB).

My dataframes are always associated with Pydantic models, so this functionality is exactly what I'd like to have.

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