-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddDatabase.py
More file actions
46 lines (42 loc) · 1.2 KB
/
addDatabase.py
File metadata and controls
46 lines (42 loc) · 1.2 KB
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
37
38
39
40
41
42
43
44
45
46
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
cred = credentials.Certificate("serviceAccountKey.json")
firebase_admin.initialize_app(cred, {
'databaseURL': "https://tifr-atas-default-rtdb.firebaseio.com/"
})
ref = db.reference('Students')
data = {
"110202":
{
"name": "Garv Jhangiani",
"major": "Computer",
"starting_year": 2019,
"total_attendance": 7,
"standing": "G",
"year": 4,
"last_attendance_time": "2022-12-11 00:54:34"
},
"101201":
{
"name": "Prerak Moolchandani",
"major": "Computer",
"starting_year": 2022,
"total_attendance": 12,
"standing": "B",
"year": 1,
"last_attendance_time": "2022-12-11 00:54:34"
},
"101101":
{
"name": "Muskan Hassanandani",
"major": "EXTC",
"starting_year": 2020,
"total_attendance": 7,
"standing": "G",
"year": 3,
"last_attendance_time": "2022-12-11 00:54:34"
}
}
for key, value in data.items():
ref.child(key).set(value)