def METHOD_NAME(BookID):
    mydb = mysql.connector.connect(
    host="db",
    user=os.environ['MYSQL_USER'],
    passwd=os.environ['MYSQL_PASSWORD']
    )
    cursor = mydb.cursor();
    ##SQL query to extract the data from the database
    query = f"SELECT * FROM opendsa.odsa_exercise_attempts where inst_book_id = {BookID} order by user_id, time_done;"
    # print(query)
    with open('/tmp/irt_curve.csv', 'w') as csvfile:
        csvwriter = csv.writer(csvfile)
        header = ['id','user_id','inst_book_id','inst_section_id','inst_book_section_exercise_id','worth_credit','time_done','time_taken','count_hints','hint_used','points_earned','earned_proficiency','count_attempts','ip_address','question_name','request_type','created_at','updated_at','correct','pe_score','pe_steps_fixed','inst_course_offering_exercise_id','inst_module_section_exercise_id','answer','question_id','finished_frame']
        csvwriter.writerow(header)
        cursor.execute(query)
        for obj in cursor:
            csvwriter.writerow(obj)
        cursor.close()
        mydb.close()
    return csvfile