-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddDataToDatabase.py
115 lines (101 loc) · 2.68 KB
/
addDataToDatabase.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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-attendance-real-tim-4a64a-default-rtdb.firebaseio.com/"
}
)
dataFolder = db.reference('Students')
data = {
"Z1":
{
"id": "Z1",
"name": "Elon Musk",
"company": "Tesla",
"Joined year": 2008,
"total attendance": 0,
"nationality": "American",
"gender": "male",
"last attendance time": "2004-02-28 00:00:00",
},
"Z2":
{
"id": "Z2",
"name": "Tim Cook",
"company": "Apple",
"Joined year": 2011,
"total attendance": 0,
"nationality": "American",
"gender": "male",
"last attendance time": "2004-02-28 00:00:00",
},
"Z3":
{
"id": "Z3",
"name": "Krithivasan",
"company": "Tata",
"Joined year": 2023,
"total attendance": 0,
"nationality": "Indian",
"gender": "male",
"last attendance time": "2004-02-28 00:00:00",
},
"Z4":
{
"id": "Z4",
"name": "Emily Blunt",
"company": "Actress",
"Joined year": 2003,
"total attendance": 0,
"nationality": "UK",
"gender": "female",
"last attendance time": "2004-02-28 00:00:00",
},
"Z5":
{
"id": "Z5",
"name": "Sunder Pichai",
"company": "Google",
"Joined year": 2015,
"total attendance": 0,
"nationality": "Indian",
"gender": "male",
"last attendance time": "2004-02-28 00:00:00",
},
"Z6":
{
"id": "Z6",
"name": "Leonor",
"company": "Spain",
"Joined year": 2005,
"total attendance": 0,
"nationality": "Spain",
"gender": "female",
"last attendance time": "2003-09-21 01:00:00",
},
"Z7":
{
"id": "Z7",
"name": "Hari",
"company": "Student",
"Joined year": 2003,
"total attendance": 0,
"nationality": "Indian",
"gender": "male",
"last attendance time": "2003-09-21 00:00:00",
},
"Z8":
{
"id": "Z8",
"name": "Ryan Roslansky",
"company": "Linkdin",
"Joined year": 2020,
"total attendance": 0,
"nationality": "American",
"gender": "female",
"last attendance time": "2004-02-28 00:00:00",
},
}
for key, value in data.items():
dataFolder.child(key).set(value)