Closed andy-takker closed 5 months ago
@andy-takker thanks for reporting this! I'm able to reproduce this and the reason for this is that we should be skipping column_properties
, but we're not.
Also, I edited your original MCVE because that was not a working program in the sense that it wouldn't even run.
Hey! I have a similar issue with the hybrid_property
decorator. I even tried to Ignore()
the field but didn't work.
Maybe something like this could work:
if getattr(column, "nullable", False):
annotation = Union[annotation, None] # type: ignore[assignment]
Maybe something like this could work:
if getattr(column, "nullable", False): annotation = Union[annotation, None] # type: ignore[assignment]
I think the fix in #510 is probably the right approach. While your approach of using getattr
works, we actually don't want polyfactory
to to set the value for column_properties
since they're computed based on other fields.
Description
Create model with declared
column_property
and try create model object with it.Got error
AttributeError: Neither 'Label' object nor 'Comparator' object has an attribute 'nullable'
URL to code causing the issue
No response
MCVE
Steps to reproduce
Screenshots
No response
Logs
Release Version
2.9.0
Platform