示例#1
0
def insert_department(department_id,cur):
    """ insert a new student into the department table """
    sql = """INSERT INTO "Department"("Department_ID", "Department_College_ID", "Department_Name", "Department_Location", "Department_Mail") VALUES (%s,%s,%s,%s,%s)"""
    
    # execute the INSERT statement
    departmentCollegeId = syntheticDataGen.getProgram()+str(syntheticDataGen.getStudentId())
    departmentName = syntheticDataGen.getProgram()
    departmentLocation = syntheticDataGen.getAddress() 
    departmentMail = syntheticDataGen.getCity()
    cur.execute(sql, (department_id,departmentCollegeId,departmentName,departmentLocation,departmentMail))
示例#2
0
def insert_student(student_id,cur):
    """ insert a new student into the students table """
    sql = """INSERT INTO "Student"("Student_Id", "Student_College_Id", "Student_Name", "Address", "Program", "Email") VALUES (%s,%s,%s,%s,%s,%s)"""
    
    # execute the INSERT statement
    studentCollegeId = syntheticDataGen.getStudentId()
    studentName = syntheticDataGen.getName()
    address = syntheticDataGen.getAddress()
    program = syntheticDataGen.getProgram()
    email = syntheticDataGen.getEmail()
    cur.execute(sql, (student_id,studentCollegeId,studentName,address,program,email))
示例#3
0
def insert_course(course_id,cur):
    """ insert a new student into the faculty table """
    sql = """INSERT INTO "Course"("Course_ID", "College_Course_ID ", "Course_Name", "Course_Capacity", "Credits", "Department_ID", "Year_Offered", "Term_Offered", "Instructor_ID") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)"""
    # execute the INSERT statement
    departmentCollegeId = getIds.get_random_department_id(cur)
    instructorid = getIds.get_random_instructor_id(cur)
    courseCollegeId = getIds.get_random_department_id(cur)
    year = syntheticDataGen.getYear()
    courseName = syntheticDataGen.getProgram()
    capacity = syntheticDataGen.getComputedScore()
    credit = syntheticDataGen.getsingleDigit()
    cur.execute(sql, (course_id,courseCollegeId, courseName, capacity, credit, departmentCollegeId, year, credit, instructorid  ))
示例#4
0
def insert_faculty(faculty_id,cur):
    """ insert a new student into the faculty table """
    sql = """INSERT INTO public."Faculty"("Faculty_Id", "Faculty_Name", "Qualification", "Salary", "Contact_Info", "Email_Id", "Department_Id")VALUES (%s, %s, %s, %s, %s, %s, %s)"""
    # execute the INSERT statement
    departmentCollegeId = getIds.get_random_department_id(cur)
    facultyCollegeId = syntheticDataGen.getStudentId()
    facultyName = syntheticDataGen.getProgram()
    qualif = syntheticDataGen.getCity()
    salary = syntheticDataGen.getComputedScore()
    facultyContact = syntheticDataGen.getAddress()[:45]
    facultyEmail = syntheticDataGen.getEmail()
    cur.execute(sql, (faculty_id, facultyName, qualif, salary, facultyContact, facultyEmail, departmentCollegeId ))
def insert_student_bulk(student_id, fileRange):
    with open('bulkIngestFile.csv', mode='w') as bulkIngestFile:
        for i in range(fileRange):
            # execute the INSERT statement
            studentCollegeId = syntheticDataGen.getStudentId()
            studentName = syntheticDataGen.getName()
            address = syntheticDataGen.getAddress()
            program = syntheticDataGen.getProgram()
            email = syntheticDataGen.getEmail()

            writer = csv.writer(bulkIngestFile,
                                delimiter=',',
                                quotechar='"',
                                quoting=csv.QUOTE_MINIMAL)
            writer.writerow([
                student_id + i, studentCollegeId, studentName, address,
                program, email
            ])
    bulkIngestFile.close()
示例#6
0
def insert_faculty_bulk(faculty_id, fileRange):
    with open('bulkIngestFile_faculty.csv', mode='w') as bulkIngestFile:
        for i in range(fileRange):
            departmentCollegeId = getIds.get_random_department_id(cur)
            facultyCollegeId = syntheticDataGen.getStudentId()
            facultyName = syntheticDataGen.getProgram()
            qualif = syntheticDataGen.getCity()
            salary = syntheticDataGen.getComputedScore()
            facultyContact = syntheticDataGen.getAddress()[:45]
            facultyEmail = syntheticDataGen.getEmail()

            writer = csv.writer(bulkIngestFile,
                                delimiter=',',
                                quotechar='"',
                                quoting=csv.QUOTE_MINIMAL)
            writer.writerow([
                faculty_id + i, facultyName, qualif, salary, facultyContact,
                facultyEmail, departmentCollegeId
            ])
    bulkIngestFile.close()