Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nisemenov
Copy link
Contributor

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 #624 (comment)

... __set_foreign_keys__ is breaking behaviour.

and

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

My intention would be:

  • 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

@nisemenov nisemenov requested a review from guacs as a code owner January 16, 2025 09:06
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant