def list_applications(): query = "SELECT * FROM application" app_list = [] try: conn = get_connection() if conn: cursor = conn.cursor() cursor.execute(query) for item in cursor: app = Application() app.appid = item[0] app.name = item[1] app.type = item[2] app.image = item[3] app.min_memory = item[4] app.num_cores = item[5] app.comments = item[6] # print('Application: ', vars(app)) app_list.append(app) cursor.close() conn.close() except mysql.connector.Error as err: logging.error('Getting Application List on Database Error: %s', err) finally: if not app_list: logging.info('Not Find any Application on Database') return app_list