Skip to content

Error on extraneous columns #258

Open

Description

Not sure if this exists, but when I do validate, it doesn't throw an error on extraneous columns. This was a feature in patito for example

Activity

  1. borchero commented on Jan 16, 2026

    @borchero
    Member

    This is intended. Other than this is the behavior in patito: would you have expected dataframely to keep the columns as well? If so, what would be your use case?

  2. ion-elgreco commented on Jan 17, 2026

    @ion-elgreco
    Author

    So using the return value of validate removes the columns, but we were only using it to see if there were errors, so we just wanted to receive an error if there are extra columns

  3. Makiv1 commented on Jan 27, 2026

    @Makiv1

    It feels like there should at least be option to raise when calling .validate on a dataframe with columns not present in the dataframely schema.

    One use of dataframely could be to monitor for schema drift of external sources. Say an external source adds another column, you might want to be notified that such a change has occurred. Dataframely could be the perfect tool for that.

    Also out of curiosity, what is the reason for not raising when extra columns exist? It feels to me at least that this choice goes against the polars philosophy of "Adhering to a strict schema". For example polars will not allow you to concatenate two dataframes with different columns unless you explicitly set how="diagonal". It is possible that two dataframes - which have both been validated by the same schema - cause an exception in a call to pl.concat() (unless how="diagonal")

    Super big fan of dataframely btw, You guys are doing some awesome work. :3

  4. datenzauberai commented on Sep 10, 2026

    @datenzauberai

    I also think it would be useful to have that option, something like

    MySchema.validate(df, error_on_extra_columns=True)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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