-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAddDatatoDatabase.py
56 lines (52 loc) · 1.45 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
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://paperless-boarding-system-default-rtdb.firebaseio.com/"
})
ref = db.reference('Users')
data = {
"134567":
{
"name": "Aditya",
"Flight_No": 123456,
"PNR": 20176790,
"Seat_No": 7,
"Date": 4,
"Departure": "2022-01-20",
"last_attendance_time": "2022-12-11 00:54:34"
},
"321654":
{
"name": "Murtaza Hassan",
"Flight_No": 123456,
"PNR": 20176790,
"Seat_No": 7,
"Date": 4,
"Departure": "2022-01-20",
"last_attendance_time": "2022-12-11 00:54:34"
},
"852741":
{
"name": "Emly Blunt",
"Flight_No": 123456,
"PNR": 20176790,
"Seat_No": 7,
"Date": 4,
"Departure": "2022-01-20",
"last_attendance_time": "2022-12-11 00:54:34"
},
"963852":
{
"name": "Elon Musk",
"Flight_No": 123456,
"PNR": 20176790,
"Seat_No": 7,
"Date": 4,
"Departure": "2022-01-20",
"last_attendance_time": "2022-12-11 00:54:34"
}
}
for key, value in data.items():
ref.child(key).set(value)