Click here to Skip to main content
15,917,627 members

Comments by pythonHumanBot (Top 3 by date)

pythonHumanBot 22-Jan-21 8:04am View    
ok, I changed the last part to:
cursor = connection.cursor()
cursor.execute(query)
db.session.commit()

So, now no error but the database doesn't update
pythonHumanBot 21-Jan-21 19:32pm View    
I'm genuinely confused... Here is the refresh button in index:


What am I missing in all this, please?

Also, the debugger just shows:
127.0.0.1 - - [21/Jan/2021 19:29:35] "GET /refresh/False HTTP/1.1" 404 -
pythonHumanBot 21-Jan-21 19:22pm View    
I'm confused, I have the same for my delete button but no URL issue, why do I have with almost the same steps?

#delete a product from the table
@app.route('/delete/', methods = ['GET', 'POST'])
def delete():
my_data = product_table.query.get(id)
db.session.delete(my_data)
db.session.commit()
flash("Stock/ETF Deleted Successfully")
return redirect(url_for('Index'))

Also, for the SQL, you mean:
SELECT
sum(portfolio_cost_total)
FROM
portfolio_table;