You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cursor.fetchall, fetchmany and fetchone fail to type-check under ty #620
cursor.fetchall, cursor.fetchmany and cursor.fetchone both fail to type-check under ty
To reproduce
# setup a connectioncursor.execute("SELECT 1")
cursor.fetchone()
# or any of the below:cursor.fetchmany()
cursor.fetchall()
The above snippet when checked with ty check repro.py gives the following:
error[missing-argument]: No argument provided for required parameter `self` of function `fetchone`
--> repro.py:103:1
|
102 | cursor.execute("SELECT 1")
103 | cursor.fetchone()
| ^^^^^^^^^^^^^^^^^
|
info: Union variant `def fetchone(self) -> None | Row` is incompatible with this call site
info: Attempted to call union type `Unknown | (bound method Cursor.fetchone() -> None | Row) | (def fetchone(self) -> None | Row)`
info: rule `missing-argument` is enabled by default
It seems ty thinks this is a union of either a bound method or static method?
I believe this could also be an issue in ty as well but thought I'd ask here first.
Expected behavior
The methods should type check correctly.
Further technical details
Python version: 3.12.11
SQL Server version: SQL Server 2017
Operating system: MacOs 26.5
ty version: Observed on both 0.29 and 0.40
I have just been getting around this with # ty: ignore[missing-argument] but I'd rather not silence the lint.
Hi Sam Leonard (@sam-leonard-ct), thanks for the detailed report!
We've been able to reproduce and confirm this is a bug on our side. We'll take this up based on our current priority list and get back to you. Will keep you posted. Thank you for trying out our driver!
The fix has now been merged and will be included in the next release on Friday. Please continue testing mssql-python, and feel free to reopen this issue if the problem persists.
Activity
sam-leonard-ct commentedon Jun 3, 2026
Curiously
cursor.fetchvaldoes type check correctly.github-actions commentedon Jun 3, 2026
Hi Sam Leonard (@sam-leonard-ct), thank you for opening this issue!
Our team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.
If you have additional information to share, please feel free to update the issue.
Thank you for your patience!
jahnvi480 commentedon Jun 4, 2026
Hi Sam Leonard (@sam-leonard-ct), thanks for the detailed report!
We've been able to reproduce and confirm this is a bug on our side. We'll take this up based on our current priority list and get back to you. Will keep you posted. Thank you for trying out our driver!
Address review: preserve case-insensitive catalog access under lowerc…
Merge branch 'main' into saumya/gh-620
Address review: guard None description and verify cache rebuild (#620)
Merge branch 'main' into saumya/gh-620
Merge branch 'main' into saumya/gh-620
FIX: fetchone/fetchmany/fetchall type-checking under ty (#620) (#631)
gargsaumya commentedon Jun 11, 2026
The fix has now been merged and will be included in the next release on Friday. Please continue testing mssql-python, and feel free to reopen this issue if the problem persists.
RELEASE:1.9.0 (#633)