I'm on pset7 buy, and I just need some explanation on how the ON DUPLICATE KEY syntax is supposed to look (at least I assume that's the issue). Btw, id and symbol are both unique keys in my portfolio data sheet. As I understand it, this means that they can only be used once in combination on that data sheet.
Once I've gotten the user's buy order and confirmed s/he can afford the purchase, here's my code to add it to the portfolio data sheet:
db.execute(""" INSERT INTO portfolio (id, symbol, shares) VALUES (:id, :symbol, :shares) ON DUPLICATE KEY UPDATE (shares = shares + :shares)""", id=session["user_id"], symbol=symbol, shares=shares)
Error I'm getting says: RuntimeError: (sqlite3.OperationalError) near "ON": syntax error [SQL: "\n INSERT INTO portfolio\n (id, symbol, shares)\n VALUES\n (3, 'GOOGL', 1)\n ON DUPLICATE KEY UPDATE\n (shares = shares + 1)"]
Thanks for any help.