'GET request to MariaDB with Python giving error

It looks like my API request is working but gives me an error in Postman. In the end, I need to return an employee's data based on their id. It looks like it's returning an array and I can't collect this properly. Would appreciate your help with this.

@app.get('/employee')
def get_employee():
    employee = []
    try:
        employee_id = request.args['employee_id']
        employee = dbi.get_employee(employee_id)
        if(employee == True):
            employee_json = json.dumps(employee, default=str)
            return Response(employee_json, mimetype="application/json", status=200)
        else:
            return Response("Please enter valid data", mimetype="plain/text", status=400)
    except:
        print("Something went wrong")
        return Response("Sorry, something is wrong with the service. Please try again later", mimetype="plain/text", status=501)
def get_employee(employee_id):
    employee = []
    conn, cursor = connect_db()
    try:
        cursor.execute(
            "select name, hired_at, hourly_wage from employee e where id = ?", [employee_id])
        employee = cursor.fetchall()
    except db.OperationalError:
        print("Something is wrong with the DB, please try again in 5 minutes")
    except db.ProgrammingError:
        print("Error running DB query, please file bug report")
    except:
        print("Something went wrong!")
    disconnect_db(conn, cursor)
    return employee


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source