Delete a ROI dataset

Description: Delete a ROI dataset
URI: /datasets/ROI/<name>
http method: DELETE
Args: rid = <ROI id>

@app.route('/datasets/ROI/<string:name>', methods=['DELETE'])
def delete_roi(name):

    cur = conn.cursor()
    if 'rid' in request.args:

        query = "DELETE FROM roi."+name+" WHERE rid = "+request.args['rid']+";"
        try:
            cur.execute(query)
            conn.commit()
            cur.close()
        except psycopg2.Error as e:
            conn.rollback()
            cur.close()
            return(e.pgerror,400)
        return ("",200)
    else:

        query = "DROP TABLE roi."+name+";"
        try:
            cur.execute(query)
            conn.commit()
            cur.close()
        except psycopg2.Error as e:
            conn.rollback()
            cur.close()
            return(e.pgerror,400)
        return

results matching ""

    No results matching ""