if test == 'training': #only have rating question for training order += 1 if dataset == 0: question_id = 4 else: question_id = int(str(dataset)+str(4)) #write row to db conn.execute(StudentsTest.insert(), {'student_id':student_id, 'test':test, 'graph_id':graph_id, 'dataset':dataset, 'question_id':question_id, 'order':order, 'complete':'no'}) #check for table and if it is there clear before writing to if engine.dialect.has_table(engine.connect(), "students_test"): conn.execute(StudentsTest.delete()) #create all the student_test table data for test in ['pre_test', 'training', 'post_test']: create_student_data(question_student_id_list, student_question_list, test, 'question') create_student_data(heuristic_student_id_list, student_question_list, test, 'heuristic')