cursor.rowcount is -1 when rows are selected
Describe the bug
cursor.rowcount = -1 instead of numbers of selected rows
To reproduce
See code and output below
Pyhon code: cursor = CONN.cursor() cursor.execute("SELECT * FROM log") print(cursor.rowcount) rows = cursor.fetchall() for row in rows: print(row.id) sys.exit()
Output:
-1
b'\x95\x8e\xff\t\xd8:]N\x95`E\x19\xd6\t\x8b\xdf'
b"\xdd\xd6\xd9':\xd6UJ\x8eT\xddA\xb6\x12JD"
b'\xc8\x92\x16\xe5\xb4\x06\x14E\xbcxg\xc0\x85\xba\xb1\xe5'
Expected behavior
Expected output 3
Further technical details
Python version: 3.13 64 bits
SQL Server version: SQL Server 2022 Express
Operating system: Win11
Modules:
mssql-python 0.10.0
python-dotenv 1.1.1
pythonnet 3.0.5
Additional context
Add any other context about the problem here.