0

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,

DavidJB
  • 2,272
  • 12
  • 30
  • 37

1 Answers1

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));
Community
  • 1
  • 1
dm03514
  • 54,664
  • 18
  • 108
  • 145