Bird
0
0

What is the effect of using lazy='dynamic' in a Flask-SQLAlchemy relationship?

medium📝 component behavior Q5 of 15
Flask - Performance Optimization
What is the effect of using lazy='dynamic' in a Flask-SQLAlchemy relationship?
AReturns a query object instead of a list, allowing further filtering.
BLoads all related objects immediately with the parent.
CPrevents loading related objects entirely.
DLoads related objects only when accessed, using a join.
Step-by-Step Solution
Solution:
  1. Step 1: Understand lazy='dynamic'

    This option returns a query object instead of a list, so you can filter or paginate before loading.
  2. Step 2: Compare with other lazy options

    It differs from lazy='select' which loads a list, and lazy='joined' which loads immediately.
  3. Final Answer:

    Returns a query object instead of a list, allowing further filtering. -> Option A
  4. Quick Check:

    lazy='dynamic' returns query object [OK]
Quick Trick: lazy='dynamic' gives query for filtering before loading [OK]
Common Mistakes:
MISTAKES
  • Thinking lazy='dynamic' loads all data immediately
  • Confusing it with lazy='joined'
  • Assuming it disables loading

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes