
Lesson 04 · 11 min
The database and Depends
A dependency hands out a database session per request and closes it afterwards.
Depends injects the result of another function into an argument. The classic example is a database session: get_db opens it, hands it over with yield, and closes it after the response. Current user, settings, and pagination work the same way.
Sign in to continue
The rest of this lesson opens after sign up
The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.