polyfactory icon indicating copy to clipboard operation
polyfactory copied to clipboard

fix(sqla_factory): changed default value for __set_foreign_keys__ attr.

Open nisemenov opened this issue 11 months ago • 1 comments

Description

  • turned __set_foreign_keys__ attribute default value to False
  • added an appropriate part of the docs

Prerequisites for this changing

Thanks to @adhtruong for https://github.com/litestar-org/polyfactory/issues/624#issuecomment-2591171953

... __set_foreign_keys__ is breaking behaviour.

and

Note a foreign key may be present without a relationship in ORM definition.

My intention was:

  • avoiding redundant factory work Although a foreign key can be used without a relationship, it is most often paired with a relationship. So a particular factory will be doing sort of a double work because creating foreign field data will be overridden by a relationship.

  • consistency in the field logic with __set_relationships__ and __set_association_proxy__ ~~(if the last one is added in the future)~~

Closes

  • Closes #624

nisemenov avatar Jan 16 '25 09:01 nisemenov

Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/632

github-actions[bot] avatar Jan 16 '25 09:01 github-actions[bot]

Closing in favour of adjusting as part of v3 to avoid backwards breaking change

adhtruong avatar Jun 14 '25 12:06 adhtruong