Open ddahan opened 1 month ago
Hi ddahan, this should work in most situations for SQLModel
though may be some edges cases not supported.
The current behaviour for SQLAlchemyFactory
is to not resolve foreign keys by default to avoid adding this complexity to this library itself. Using the example here and using a persistence handler so SQLA resolves these references should fix the example
Summary
Hi there. After browsing the documentation (and some issues/PR), I'm still not sure if
SQLModel
is properly supported at this time. SQLModel objects have the particularity to be both Pydantic and SQLAlchemy objects, so in theory, it may work usingSQLAlchemyFactory
.But after trying by myself with this code:
With this code, the relationship is not actually created with the factory. I guess it's because polyfactory does not detect the
Relationship()
field which is specific to SQLModel.So:
Thanks! Keep up the great work.