Bird
0
0

You wrote this repository method:

medium📝 Debug Q14 of 15
Flask - Ecosystem and Patterns
You wrote this repository method:
def add_user(self, user):
    db.session.add(user)
    db.session.commit

What is the error here?
AMissing parentheses after commit method call
Bdb.session.add should be db.add
Cuser parameter should be a dictionary, not an object
Dcommit should be called before add
Step-by-Step Solution
Solution:
  1. Step 1: Check method calls on db.session

    The commit method must be called with parentheses: commit().
  2. Step 2: Identify the missing parentheses error

    Without parentheses, commit is just a reference, so changes are not saved.
  3. Final Answer:

    Missing parentheses after commit method call -> Option A
  4. Quick Check:

    commit() needs parentheses to execute [OK]
Quick Trick: Always call commit() with parentheses [OK]
Common Mistakes:
MISTAKES
  • Forgetting parentheses on commit
  • Using db.add instead of db.session.add
  • Calling commit before add

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes