Menu

How to get the number of affected rows?

Help
2001-12-30
2012-09-19
  • Joao Prado Maia

    Joao Prado Maia - 2001-12-30

    Using the normal MySQLdb module, how can I get the number of affected rows for a DELETE statement?

    Joao

     
    • Andy Dustman

      Andy Dustman - 2001-12-30

      cursor.execute() will return the number of affected rows. You can also look at cursor.rowcount. This is true for any SQL statement (DELETE, INSERT, SELECT, UPDATE, etc.)

       
    • Joao Prado Maia

      Joao Prado Maia - 2001-12-31

      Ah, very cool. Thanks for the information! :)

      Joao

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.