-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddData_database.py
More file actions
94 lines (82 loc) · 2.48 KB
/
AddData_database.py
File metadata and controls
94 lines (82 loc) · 2.48 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
# IMPORTING OUR FIREBASE DATABASE
cred = credentials.Certificate("project/realtimefaceattendence-87692-firebase-adminsdk-rkz7t-4f8a26e0ff.json")
firebase_admin.initialize_app(cred, {
'databaseURL': "https://realtimefaceattendence-87692-default-rtdb.firebaseio.com/"
})
# THIS WILL CREATE A DIRECTORY FOR THE STUDENTS IN THE FIREBASE REALTIME DATABASE
ref = db.reference('Students')
# CREATING DATA
data = {
"101":
{
# "KEY" : "VALUE"
"name":"Supratim Paul",
"major" : "Comitetive programmer",
"starting_year" : 2020,
"total_attendence": 0,
"standing": "G",
"year": 4,
"last_attendance_time" : "2022-12-06 00:54:34"
},
"102":
{
# "KEY" : "VALUE"
"name":"Elon Musk",
"major" : "Physics",
"starting_year" : 2020,
"total_attendence": 0,
"standing": "G",
"year": 2,
"last_attendance_time" : "2022-12-06 00:54:34"
},
"103":
{
# "KEY" : "VALUE"
"name":"Ana De Armas",
"major" : "Actor",
"starting_year" : 2021,
"total_attendence": 0,
"standing": "G",
"year": 1,
"last_attendance_time" : "2022-12-06 00:54:34"
},
"104":
{
# "KEY" : "VALUE"
"name":"Deep Senchowa",
"major" : "Comitetive programmer",
"starting_year" : 2020,
"total_attendence": 0,
"standing": "B",
"year": 4,
"last_attendance_time" : "2022-12-06 00:54:34"
},
"105":
{
# "KEY" : "VALUE"
"name":"Sundar Pichai",
"major" : "Google Ceo",
"starting_year" : 2020,
"total_attendence": 0,
"standing": "B",
"year": 4,
"last_attendance_time" : "2022-12-06 00:54:34"
},
"106":
{
# "KEY" : "VALUE"
"name":"Bidagddha Konwar",
"major" : "Electronic Engineering",
"starting_year" : 2020,
"total_attendence": 0,
"standing": "B",
"year": 4,
"last_attendance_time" : "2022-12-06 00:54:34"
},
}
# SENDING THE DATA TO OUR REALTIME DATABASE
for key,value in data.items():
ref.child(key).set(value)