-
Notifications
You must be signed in to change notification settings - Fork 1
/
seed.py
131 lines (124 loc) · 3.56 KB
/
seed.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
from manpower_api.database import SessionLocal
from manpower_api.employees.models import Employee
db = SessionLocal()
employee_data_list = [
{
"nric4Digit": "1234",
"name": "John Doe",
"manpowerId": "EMP1001",
"designation": "Software Engineer",
"project": "Project X",
"team": "Development",
"supervisor": "Jane Smith",
"joinDate": "2023-01-01",
"resignDate": None,
},
# Add more employee data dictionaries here...
{
"nric4Digit": "5678",
"name": "Alice Lee",
"manpowerId": "EMP1002",
"designation": "Marketing Manager",
"project": "Campaign Y",
"team": "Marketing",
"supervisor": "David Kim",
"joinDate": "2022-06-15",
"resignDate": "2024-02-29",
},
{
"nric4Digit": "9012",
"name": "Michael Brown",
"manpowerId": "EMP1003",
"designation": "Data Analyst",
"project": "Data Insights Initiative",
"team": "Analytics",
"supervisor": "Charles Williams",
"joinDate": "2021-12-07",
"resignDate": None,
},
{
"nric4Digit": "3456",
"name": "Sarah Jones",
"manpowerId": "EMP1004",
"designation": "Human Resources Specialist",
"project": "Employee Onboarding Program",
"team": "HR",
"supervisor": "Emily Gar",
"joinDate": "2020-05-18",
"resignDate": None,
},
{
"nric4Digit": "7890",
"name": "David Miller",
"manpowerId": "EMP1005",
"designation": "Sales Manager",
"project": "Regional Sales Expansion",
"team": "Sales",
"supervisor": "Robert Johnson",
"joinDate": "2023-07-12",
"resignDate": None,
},
{
"nric4Digit": "1357",
"name": "Lisa Chang",
"manpowerId": "EMP1006",
"designation": "Graphic Designer",
"project": "Company Branding Refresh",
"team": "Marketing",
"supervisor": "Alice Lee",
"joinDate": "2022-09-21",
"resignDate": None,
},
{
"nric4Digit": "2468",
"name": "Daniel Lee",
"manpowerId": "EMP1007",
"designation": "Software Developer",
"project": "Project X (continued from previous data)",
"team": "Development",
"supervisor": "John Doe",
"joinDate": "2023-04-05",
"resignDate": None,
},
{
"nric4Digit": "8901",
"name": "Emily Garcia",
"manpowerId": "EMP1008",
"designation": "HR Manager",
"project": "Project Hiring",
"team": "HR",
"supervisor": "Jack Paul",
"joinDate": "2018-02-14",
"resignDate": None,
},
{
"nric4Digit": "0234",
"name": "Christopher Williams",
"manpowerId": "EMP1009",
"designation": "Accountant",
"project": "Project Account",
"team": "Finance",
"supervisor": "Emily Garcia",
"joinDate": "2019-11-01",
"resignDate": None,
},
{
"nric4Digit": "5679",
"name": "Jessica Robinson",
"manpowerId": "EMP1010",
"designation": "Customer Service Representative",
"project": "Customer 5 Star",
"team": "Customer Support",
"supervisor": "David Miller",
"joinDate": "2024-03-19",
"resignDate": None,
},
]
# Insert sample employee data
for employee_data in employee_data_list:
new_employee = Employee(**employee_data)
db.add(new_employee)
db.commit()
# Close the session
db.close()
print("Done seed dump data!")