How to get rows affected in a UPDATE statement by PyMSQL
<p>See the title,I need to update some rows on mysql database by PyMYSQL and I want to know <strong>how many rows had been changed.</strong></p>

<p>code:
<code>
    import pymysql
    db = pymysql.connect(xxxx)
    cur = db.cursor()
    sql = "update TABLE set A = 'abc' where B = 'def'"
    cur.execute(sql, params)
    db.commit()
</code></p>

<p>You can do this by <code>cursor.rowcount</code> after executing stage. Ff return value of this is opposite of 0 it means one or more rows are affected.</p>

python mysql pymysql