-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Describe the bug
A clear and concise description of what the bug is.

I noticed this discrepancy between mssql-python and SSMS but also verified the discrepancy exists with pyodbc (pyodbc does less calls like SSMS) so it doesn't seem to be just a python thing.
mssql-python instantiates a cursor while other tools just run a batch. mssql-python then makes 3 subsequent round trips to the server - 2 x sp_cursor_fectch and 1 x sp_cursorclose. In this example I was selecting 5 rows but I see the same exact 4 calls even when selecting a top 1.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Exception message:
Stack trace:
To reproduce
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
I was using this quickstart: https://learn.microsoft.com/sql/connect/python/mssql-python/python-sql-driver-mssql-python-connect-jupyter-notebook although you should be able to repro with select 1
I used the XEvent Profiler, Standard template in SSMS 22 preview 3

Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
print("Hello World!")
Expected behavior
A clear and concise description of what you expected to happen.
Further technical details
Python version: 3.13
SQL Server version: Fabric SQL database
Operating system: Windows 11 arm64
Additional context
Add any other context about the problem here.