-
-
Notifications
You must be signed in to change notification settings - Fork 368
Fixed issue where Pandera cannot handle metadata through Annotated types #2111
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
base: main
Are you sure you want to change the base?
Conversation
> > Co-authored-by: Kevin Jijon <[email protected]> > Co-authored-by: Karan Verma <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2111 +/- ##
===========================================
- Coverage 94.28% 82.69% -11.59%
===========================================
Files 91 135 +44
Lines 7013 10589 +3576
===========================================
+ Hits 6612 8757 +2145
- Misses 401 1832 +1431 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
thanks for the contribution @NGHades ! looks like there are a few failing tests. you can repro this locally using |
| if field_info_list: | ||
| existing_field = field_info_list[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be useful to provide an inline comment here, why you're retrieving the first item
Problem
This PR addresses issue #2110, which we (@kevJ711 and @KViruz2750) identified while working with Annotated types in conjunction with pa.Field(...).
Description
When defining schema models using Annotated along with pa.Field(...), metadata such as description, unique, and title was not being correctly propagated into the resulting DataFrameModel.
Solution
We introduced a more rigorous check for parsing Annotated types to ensure that any AnnotationInfo attached to a type is correctly handled and its metadata extracted. This change allows the model to capture and utilize metadata as expected.
Additionally, we observed that certain built-in types (str, int, float, bool) do not support parameterization. To prevent issues when handling these types, we added a check that safely returns an empty metadata dictionary for them.