Documentation Home
MySQL Connector/Python Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.7Mb
PDF (A4) - 0.7Mb


10.5.20 MySQLCursor.rowcount Property

Syntax:

count = cursor.rowcount

This read-only property returns the number of rows returned forSELECT statements, or the number of rows affected by DML statements such asINSERT orUPDATE. For an example, seeSection 10.5.7, “MySQLCursor.execute() Method”.

For nonbuffered cursors, the row count cannot be known before the rows have been fetched. In this case, the number of rows is -1 immediately after query execution and is incremented as rows are fetched.

Therowcount property is like themysql_affected_rows() C API function; seemysql_affected_rows().