Reputation: 676
Have already looked at these similar issues, but have had no joy:
PHP MySQL Query doesn't work, but works from terminal Sqlite update don't working right - python
I am using Flask with SQLite and have the following query:
g.db.execute( "UPDATE article_views SET views=views+1 WHERE id=:id" , { "id": this_id } )
Where this_id is an integer. This executes without error. But when I check my db, the expected update has not occurred.
Does anyone have any insight here?
Upvotes: 1
Views: 404
Reputation: 142126
I'm not 100% sure, but I believe the placeholder for Sqlite3 is ?
not :1
or %s
style - have you tried to see if the following works:
g.db.execute( "UPDATE article_views SET views=views+1 WHERE id=?", (this_id,) )
Although I would expect an error of some sort, not just a silent failure...
Upvotes: 0
Reputation: 1121486
I suspect you need to commit your transaction too:
g.db.commit()
Upvotes: 7