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

chore: Use implicit default loading rather than explicit joined eager loading #1961

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

john-bodley
Copy link
Contributor

@john-bodley john-bodley commented Dec 14, 2022

Description

A rehash of #1959 but, per #1959 (comment), rather than explicitly defining the form of the relationship loading rely instead on the implicit definition of the specific model relationships (which defaults to lazy per here). This helps to ensure that the optimal loading technic is used for each specific implementation/use case.

See Relationship Loading Techniques for the various relationship loading techniques which are supported by SQLAlchemy which fall into one of three categories: lazy, eager, or none. Lazy implies delayed loading and results in N +1 queries, whereas eager loading "eagerly" loads items alongside the parent—either using a separate SELECT statement or using JOIN clause (which can lead to a multiplicative issue when the parent has multiple relationships).

ADDITIONAL INFORMATION

  • Has associated issue:
  • Is CRUD MVC related.
  • Is Auth, RBAC security related.
  • Changes the security db schema.
  • Introduces new feature
  • Removes existing feature

Copy link
Owner

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome I like this approach. Thank you!

@dpgaspar dpgaspar merged commit adf2472 into dpgaspar:master Dec 16, 2022
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.

2 participants