From the documentation:
As required by the Python DB API Spec,
the rowcount attribute “is -1 in case
no executeXX() has been performed on
the cursor or the rowcount of the last
operation is not determinable by the
interface”.This includes
SELECT
statements
because we cannot determine the number
of rows a query produced until all
rows were fetched.
That means all SELECT
statements won’t have a rowcount
. The behaviour you’re observing is documented.
EDIT: Documentation doesn’t say anywhere that rowcount
will be updated after you do a fetchall()
so it is just wrong to assume that.