def create_tables(): #create student table and insert data ak47.create_header_test("student", student_attr_name, student_attr_type) ak47.insert_data_test("student", student_attr_name, student_attr_value_1, student_attr_type) ak47.insert_data_test("student", student_attr_name, student_attr_value_2, student_attr_type) ak47.insert_data_test("student", student_attr_name, student_attr_value_3, student_attr_type) ak47.insert_data_test("student", student_attr_name, student_attr_value_4, student_attr_type) ak47.insert_data_test("student", student_attr_name, student_attr_value_5, student_attr_type) ak47.insert_data_test("student", student_attr_name, student_attr_value_6, student_attr_type) ak47.insert_data_test("student", student_attr_name, student_attr_value_7, student_attr_type) ak47.insert_data_test("student", student_attr_name, student_attr_value_8, student_attr_type) #create class table and insert data ak47.create_header_test("class", class_attr_name, class_attr_type) ak47.insert_data_test("class", class_attr_name, class_attr_value_1, class_attr_type) ak47.insert_data_test("class", class_attr_name, class_attr_value_2, class_attr_type) ak47.insert_data_test("class", class_attr_name, class_attr_value_3, class_attr_type) ak47.insert_data_test("class", class_attr_name, class_attr_value_4, class_attr_type) #create class_2 table and insert data ak47.create_header_test("class_2", class_2_attr_name, class_2_attr_type) ak47.insert_data_test("class_2", class_2_attr_name, class_2_attr_value_1, class_2_attr_type) ak47.insert_data_test("class_2", class_2_attr_name, class_2_attr_value_2, class_2_attr_type) ak47.insert_data_test("class_2", class_2_attr_name, class_2_attr_value_3, class_2_attr_type) ak47.insert_data_test("class_2", class_2_attr_name, class_2_attr_value_4, class_2_attr_type) #create class_3 table and insert data ak47.create_header_test("class_3", class_3_attr_name, class_3_attr_type) ak47.insert_data_test("class_3", class_3_attr_name, class_3_attr_value_1, class_3_attr_type) ak47.insert_data_test("class_3", class_3_attr_name, class_3_attr_value_2, class_3_attr_type) ak47.insert_data_test("class_3", class_3_attr_name, class_3_attr_value_3, class_3_attr_type) ak47.insert_data_test("class_3", class_3_attr_name, class_3_attr_value_4, class_3_attr_type) return 1
def get_attr_type_test(): """ >>> map(get_type_name, map(get_attr_type, ["1", "1.2", "a", "#", "2021-05-10", "12:12:12", "false", "2011-12-12 13:42:30"])) ['int', 'float', 'varchar', 'varchar', 'date', 'time', 'boolean', 'datetime'] """ # init and load sql_executor function initialize() executor = sql_executor() student_attr_name = ["id_student", "first_name", "last_name", "year_of_birth", "grade_avg"] student_attr_type = [ak47.TYPE_INT, ak47.TYPE_VARCHAR, ak47.TYPE_VARCHAR, ak47.TYPE_INT, ak47.TYPE_FLOAT] ak47.create_header_test("student", student_attr_name, student_attr_type) insert_into1_output = executor.insert("INSERT INTO student VALUES ('1','Marko','Sinko','1990','2.0')") insert_into2_output = executor.insert( "INSERT INTO student(id_student, first_name, last_name, year_of_birth, grade_avg) VALUES ('2','Marinko','Radic','1991','3.3')") insert_into3_output = executor.insert( "INSERT INTO profesor(id_student, first_name, last_name, year_of_birth, grade_avg) VALUES ('2','Marinko','Radic','1991','3.3')") def insert_into_test(): """ >>> insert_into1_output True >>> insert_into2_output True >>> insert_into3_output
def create_table_header(self, table, attr_name, attr_type): return ak47.create_header_test(table, attr_name, attr_type)