-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddDataToDatabase.py
More file actions
36 lines (31 loc) · 859 Bytes
/
Copy pathAddDataToDatabase.py
File metadata and controls
36 lines (31 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
cred = credentials.Certificate("serviceAccountKey.json")
firebase_admin.initialize_app(cred,{
'databaseURL':"#",
'storageBucket':"#"
})
ref = db.reference('Students')
data = {
"CSE21-073" : {
"name": "Nikhil Shukla",
"department": "ComputerScience",
"starting_year": 2021,
"total_attendance": 2,
"standing": "B1",
"year": 2,
"last_attendance_time": "2023-03-19 04:03:00"
},
"CSE21-060": {
"name": "Lawnish",
"department": "ComputerScience",
"starting_year": 2021,
"total_attendance": 1,
"standing": "A1",
"year": 2,
"last_attendance_time": "2023-03-19 04:03:00"
}
}
for key,value in data.items():
ref.child(key).set(value)