-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFirebase.py
71 lines (67 loc) · 1.87 KB
/
Firebase.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
67
68
69
70
71
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://face-recog-python-ec2ea-default-rtdb.asia-southeast1.firebasedatabase.app/'
})
ref = db.reference('Students')
# python dictionary
data = {
"TP011111":{
"name" : "Lee Wen Han",
"major" : "CS(AI)",
"starting_year" : 2021,
"total_attendance" : 20,
"grades" : "A",
"year" : 2,
"last_attendance_taken" : "2024-01-26 16:10:30",
},
"TP012345":{
"name" : "TP 012345",
"major" : "CS(AI)",
"starting_year" : 2021,
"total_attendance" : 20,
"grades" : "A",
"year" : 2,
"last_attendance_taken" : "2024-01-26 16:10:30",
},
"TP054321":{
"name" : "TP 054321",
"major" : "CS(AI)",
"starting_year" : 2021,
"total_attendance" : 20,
"grades" : "A",
"year" : 2,
"last_attendance_taken" : "2024-01-26 16:10:30",
},
"TP063338":{
"name" : "TP 063338",
"major" : "CS(AI)",
"starting_year" : 2021,
"total_attendance" : 20,
"grades" : "A",
"year" : 2,
"last_attendance_taken" : "2024-01-26 16:10:30",
},
"TP068713":{
"name" : "Suzanne Lai",
"major" : "CS(AI)",
"starting_year" : 2021,
"total_attendance" : 20,
"grades" : "A",
"year" : 2,
"last_attendance_taken" : "2024-01-26 16:10:30",
},
"TP088888":{
"name" : "TP 088888",
"major" : "CS(AI)",
"starting_year" : 2021,
"total_attendance" : 20,
"grades" : "A",
"year" : 2,
"last_attendance_taken" : "2024-01-26 16:10:30",
},
}
for key, value in data.items():
ref.child(key).set(value)