count = cursor.rowcount
This read-only property returns the number of rows returned for
SELECT statements, or the number
of rows affected by DML statements such as
UPDATE. For an example, see
Section 220.127.116.11, “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.