How to loop through each firebase database child with python? -


i have firebase data structure

enter image description here

i want print keys under firebase generated keys (i.e 3030-00-809-7702 newnsn) use code

inventory = db.child("inventories").get() business in inventory.each(): businessid = business.key() productdb = db.child("inventories").child(businessid).get()   product in productdb.each():     productid = product.key() print(businessid) print(productid) 

but

enter image description here

so last keys being printed instead of keys. doing wrongly , how can print keys ?

just print value @ current tree whole thing

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

or go iterate it, inefficient request n items firebase n children.

inventorydb = db.child("inventories") businessid in inventorydb.shallow().get().each():     productdb = inventory.child(businessid)     # print ids     print([id id in productdb.shallow().get()]) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -