I'm new to python
. I'm using a firebase firestore
database for this project. After entering the Admission_No
, I want to retrieve all the data in the relevant document such as name
, grade
, phone
. I tried to write a program for it. But I failed. Please help me to complete my project. Thank you all.
The Code might be full of mistakes. Please don't mind it and fix them for me.
Here is my Code
.py
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
cred = credentials.Certificate("cred.json")
firebase_admin.initialize_app(cred)
db = firestore.client()
data = {
'Admission_No': input('enter ad_no : ')
}
query_ad = db.collection(u'Users').where(u"Admission_No", u"==", data["Admission_No"]).get()
get_data = db.collection(u'Users').where(u"Name", u"==", data["Name"]).get()
if query_ad:
print('Exist')
print(get_data)
else:
print("Doesn't Exist")