Closed wangxin688 closed 3 months ago
seems main
was broken for mypy.
tests/test_recursive_models.py:56: error: Non-overlapping identity check (left operand type: "PydanticNode", right operand type: "type[_Sentinel]") [comparison-overlap]
seems there's no way to reflect JSON
or JSONB
's python type. so should I remove JSON, JSONB in types maping? or treat it as dict by default?. becuase JSON and JSONB also support list[Any]
? what's you guys ideas?
seems there's no way to reflect
JSON
orJSONB
's python type. so should I remove JSON, JSONB in types maping? or treat it as dict by default?. becuase JSON and JSONB also supportlist[Any]
? what's you guys ideas?
Yeah, array is valid json - I'd have to defer to @guacs on what is the right way to handle this for polyfactory.
seems there's no way to reflect
JSON
orJSONB
's python type. so should I remove JSON, JSONB in types maping? or treat it as dict by default?. becuase JSON and JSONB also supportlist[Any]
? what's you guys ideas?Yeah, array is valid json - I'd have to defer to @guacs on what is the right way to handle this for polyfactory.
Just my ideas, maybe not the best way.
add a migac method to sqlafactory, such as __default_json_type__: ClassVar[type] = dict
, but it can be change as other type when inherit from factory. then handle the JSON
type by magic method definition.
seems there's no way to reflect
JSON
orJSONB
's python type. so should I remove JSON, JSONB in types maping? or treat it as dict by default?. becuase JSON and JSONB also supportlist[Any]
? what's you guys ideas?Yeah, array is valid json - I'd have to defer to @guacs on what is the right way to handle this for polyfactory.
Just my ideas, maybe not the best way. add a migac method to sqlafactory, such as
__default_json_type__: ClassVar[type] = dict
, but it can be change as other type when inherit from factory. then handle theJSON
type by magic method definition.
I have remove JSON
and JSONB
types due to uncertain python types.
BTW, I didnot see types.Uuid
in get_sqlalchemy_types
, after my local test, it's well suited with types.Uuid: uuid4
add to return dict.
@wangxin688 thanks for this!
For the JSON and JSONB, I think we can default to a random dictionary. If the users need something other than the deafult, they can override the get_sqlalchemy_types
or get_provider_map.
looks like main branch is broken for lint again. @guacs JSON has been added back. pls review
looks like main branch is broken for lint again. @guacs JSON has been added back. pls review
may I ask why lint rule is checked for all files not newly changed files?
looks like main branch is broken for lint again. @guacs JSON has been added back. pls review
I executed pre-commit run --all-files
on my PC, no issues were reported. As it's not related for this PR, how to skip linting checking? --
looks like main branch is broken for lint again. @guacs JSON has been added back. pls review
I executed
pre-commit run --all-files
on my PC, no issues were reported. As it's not related for this PR, how to skip linting checking? --
Skipping it isn't possible though it can be merged even if the linting fails. I'll fix the linting issues and try to make it only lint the changes files (sometime this week) and once that's merged, we can merge that into this branch?
Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/530
enhance sqlalchemy factory support postgresql dialects.
Description
JSON
,JSONB
andHSTORE
typeARRAY(INET), ARRAY(MACADDR)
and etcCloses