Closed vickypalani closed 3 months ago
Hi @vickypalani, could you try adding adding __set_relationships__
? Docs here. By default these, relationships are not set as these causes some issues with recursive relationships originally.
@vickypalani I think the solution mentioned above should work. If not, feel free to reopen the issue.
Hi @adhtruong thanks for the response, @guacs sorry for not updating the status of the issue. I was able to resolve this after going through the documentation last week. This is how my factory looks right now,
class EmailTemplateFactory(BaseFactory):
"""Factory for generating EmailTemplate dummy data."""
__model__ = EmailTemplate
__set_relationships__ = True
category = EmailCategoryFactory
created_by = UserFactory
Hi, I'm facing some trouble while creating factories that involve ForeignKeys in SQLAlchemy...
When I try to create an EmailCategory model instance, I get an IntegrityError mentioning that the random integer assigned to foreign key field is not present in the table "email_categories" (which is expected). Right now I'm passing the foreign_key values manually, like this
Is there any other way to implement the same?