-
Notifications
You must be signed in to change notification settings - Fork 1
/
AddDataToDB.py
66 lines (62 loc) · 1.69 KB
/
AddDataToDB.py
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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://smart-attendance-system-c2a01-default-rtdb.firebaseio.com/"
})
ref=db.reference('Students')
data={
"1":
{
"name":"Soumyadeep Mukherjee",
"major":"IT",
"starting_year":2019,
"total_attendance":7,
"grade": "O",
"year":4,
"last_attendance_time":"2023-01-10 12:30:00"
},
"2":
{
"name":"Sundar Pichai",
"major":"Computer Science",
"starting_year":2020,
"total_attendance":7,
"grade": "O",
"year":3,
"last_attendance_time":"2023-01-10 11:30:00"
},
"3":
{
"name":"Elon Musk",
"major":"Physics",
"starting_year":2021,
"total_attendance":4,
"grade": "E",
"year":2,
"last_attendance_time":"2023-01-10 11:30:00"
},
"4":
{
"name":"Sparsh Singh",
"major":"IT",
"starting_year":2019,
"total_attendance":2,
"grade": "A",
"year":4,
"last_attendance_time":"2023-01-10 11:30:00"
},
"5":
{
"name":"Tannistha Muhuri",
"major":"IT",
"starting_year":2019,
"total_attendance":6,
"grade": "E",
"year":4,
"last_attendance_time":"2023-01-10 11:30:00"
}
}
for key,value in data.items():
ref.child(key).set(value)