Doubt in usage of polyfactory #524
-
Hi, I recently started working on a FastAPI project where I needed to create dummy data for a SQLAlchemy model that has a unique field. This is my code to implement it.
When I try to create a batch like this,
I get an issue since the name field uses the same value for all the instances, thus triggering the UniqueConstraint error.
Note While we are open for sponsoring on GitHub Sponsors and Check out all issues funded or available for funding on our Polar.sh dashboard
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Can you try this?
I would recommend |
Beta Was this translation helpful? Give feedback.
Can you try this?
I would recommend
name = Use(lambda: RoleTypeFactory.__faker__.name())
instead of creating your own faker