I've been using mySQLdb in python to import data into a database, however I would also like to be able to address a specific row and update a cell in that row, I couldn't find the command to do this in the mySQLdb help file, would anyone be kind enough to point me in the right direction...
Thanks,
asked Feb 4, 2013 at 18:03
DavidJB
2,36212 gold badges31 silver badges38 bronze badges
1 Answer 1
You can use a sql UPDATE statement
psuedo data schema:
# table people
id INT, name VARCHAR(40), age INT, address VARCHAR(100)
1, john, 33, North America
2, dm03514, 28, Maryland
using pythong MySQLdb
cursor.execute('UPDATE people SET address = %s WHERE id = %s', ('Columbia, MD', 2));
answered Feb 4, 2013 at 18:10
dm03514
56.2k18 gold badges117 silver badges147 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py