Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

are pydantic BeforeValidator and AfterValidator annotations supported? #42

Open
hottwaj opened this issue Mar 8, 2024 · 3 comments
Open

Comments

@hottwaj
Copy link

hottwaj commented Mar 8, 2024

Thanks!

@chainyo
Copy link
Contributor

chainyo commented Mar 19, 2024

Hi, from my testing this is not working when you load data with polars and then validate the polars.DataFrame with the pre-defined model, e.g.:

data = polars.read_csv("data.csv", has_header=True)
try:
    Model.validate(data)
except Exception as e:
    print(e)

It doesn't work either this way:

data = Model.DataFrame.read_csv("data.csv", has_header=True)

BUT it works if you create the object directly: Model(*args, **kwargs)

@lmmx
Copy link
Contributor

lmmx commented Sep 9, 2024

It looks like this is resolved now?

@lmmx lmmx moved this to ✅ Done in Planner Sep 9, 2024
@chainyo
Copy link
Contributor

chainyo commented Sep 10, 2024

It looks like this is resolved now?

I did another way but they aren't included in the patito package. I coded the application of the validators myself using polars method as much as possible in the loading methods I created to load data and validating it.

@lmmx lmmx removed this from Planner Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants