This repository was archived by the owner on May 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_db.py
More file actions
130 lines (120 loc) · 3.29 KB
/
init_db.py
File metadata and controls
130 lines (120 loc) · 3.29 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
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
# File to reset database when needed
import sqlalchemy
import sqlalchemy.orm
import models
import os
db_url = os.getenv("DATABASE_URL")
# If you need to manually add something, update the fields below according
# to the Instructions for Updating TigerJobs document
# For info on the fields, look at the TigerJobs Programmer's Guide
# def add_test_user(session):
# user = models.Users(
# netid = ,
# major = ,
# certificates = ,
# grade = ,
# admin = ,
# )
# session.add(user)
# def add_test_company(session):
# company = models.Companies(
# name = ,
# num_interviews = ,
# num_internships = ,
# interview_difficulty = ,
# interview_enjoyment = ,
# internship_supervisor = ,
# internship_pay = ,
# internship_balance = ,
# internship_culture = ,
# internship_career = ,
# internship_difficulty = ,
# internship_enjoyment = ,
# locations= [],
# location_count= [],
# fields= [],
# field_count=[],
# majors= [],
# major_count=[],
# interview_grades = [0, 0, 0, 0, 0],
# internship_grades = [0, 0, 0, 0, 0],
# advanced = ,
# enjoyed_interview = ,
# enjoyed_internship = ,
# difficult_interview = ,
# difficult_internship = ,
# reported =
# )
# session.add(company)
# def add_test_job(session):
# internship = models.Internships(
# netid = ,
# title = ,
# location = ,
# virtual = ,
# description = ,
# technologies = ,
# type = ,
# length = ,
# company = ,
# company_id = ,
# company_type = ,
# salary = ,
# supervisor = ,
# pay = ,
# balance = ,
# culture = ,
# career_impact = ,
# difficulty = ,
# enjoyment = ,
# upvotes = [],
# major = ,
# certificates = ,
# grade = ,
# date_created = ,
# reported =
# )
# session.add(internship)
# def add_test_interview(session):
# interview = models.Interviews(
# # Update interview info here
# netid = ,
# round = ,
# final_round = ,
# job_position = ,
# job_field = ,
# type= ,
# location_type= ,
# duration = ,
# company = ,
# company_id = ,
# num_interviewers = ,
# question_description = ,
# technologies = ,
# how_interview = ,
# tips = ,
# difficulty = ,
# enjoyment = ,
# advanced = ,
# upvotes = [],
# major = ,
# certificates = ,
# grade = ,
# date_created = ,
# reported =
# )
# session.add(interview)
def main():
# Create engine and drop and recreate all tables
engine = sqlalchemy.create_engine(db_url)
models.Base.metadata.create_all(engine)
with sqlalchemy.orm.Session(engine) as session:
# Add whatever you need here and uncomment corresponding functions above
# add_test_user(session)
# add_test_company(session)
# add_test_job(session)
# add_test_interview(session)
session.commit()
engine.dispose()
if __name__ == '__main__':
main()