Skip to content Skip to sidebar Skip to footer

How To Loop Through Each Firebase Database Child With Python?

I have this firebase data structure I want to print all the keys under the firebase generated keys (i.e from 3030-00-809-7702 to newNSN) so I use this code Inventory = db.child(

Solution 1:

Just print the value at the current tree to get the whole thing

inventory = db.child("Inventories").get()
for business in inventory.each():
    print(business.val())

Or you go iterate it, which is really inefficient to request N items from Firebase for N children.

inventorydb = db.child("Inventories")
for businessid in inventorydb.shallow().get().each():
    productdb = inventory.child(businessid)
    # print the idsprint([idforidin productdb.shallow().get()])

Post a Comment for "How To Loop Through Each Firebase Database Child With Python?"