How to Solve NameError: name 'db' is not defined -- firebase_admin

Solution: Import the 'db' module

To Solve the error, add the following line to the top of your code.

from firebase_admin import db

 

For more information:
Python firebase_admin db