-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddDataToDatabase..py
More file actions
60 lines (52 loc) · 1.55 KB
/
Copy pathaddDataToDatabase..py
File metadata and controls
60 lines (52 loc) · 1.55 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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://attendance-system-real-time-default-rtdb.firebaseio.com/"
})
ref = db.reference('Students')
data = {
"518468" :
{
"name" : "Leo Messi" ,
"major" : "Football" ,
"starting_year" : "2006" ,
"total-attendance" : 6 ,
"standing" : "G" ,
"year" : 4 ,
"last_attendance_time" : "2023-08-15 00:54:34"
},
"645151":
{
"name": "Anas Hizem",
"major": "Software Engineering Student",
"starting_year": "2022",
"total-attendance": 2,
"standing": "G",
"year": 1,
"last_attendance_time" : "2023-08-15 00:54:34"
},
"848754":
{
"name": "Mark Zuckerberg",
"major": "Computer Science",
"starting_year": "2004",
"total-attendance": 10,
"standing": "G",
"year": 10,
"last_attendance_time" : "2023-08-15 00:54:34"
},
"864215" :
{
"name": "Elon Musk",
"major": "physics and economics",
"starting_year": "2008",
"total-attendance": 0,
"standing": "G",
"year": 5,
"last_attendance_time": "2023-08-15 00:54:34"
}
}
for key , value in data.items():
ref.child(key).set(value)