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 18.104.22.168, “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.