I'm trying to make it check if the user already owns this stock, and if they do, then to update the portfolio. I'm confused about how to get this code to work as I don't understand how to check if it exists. This is what I have, any help would be great!
db.execute("SELECT CASE\
SELECT user_id && stock == True\
THEN UPDATE PORTFOLIO SET shares += newshares\
VALUES (:user_id, :stock, :shares, :newshares)", user_id=session["user_id"], stock=stock["symbol"], shares = shares, newshares = newshares)