# Microsoft Python Engineering

Read the latest updates about all things Python at Microsoft

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Pylance + Pyrefly: bring your preferred type checker to Visual Studio Code

DevFeed: [Pylance + Pyrefly: bring your preferred type checker to Visual Studio Code](<https://devfeed.tech/articles/pylance-pyrefly-bring-your-preferred-type-checker-to-visual-studio-code-93020.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/announcing-tsp/>)

Author: Brett Cannon

Published: 2026-10-21T16:42:20Z

Content type: release

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [code-completion](<https://devfeed.tech/topics/code-completion.md>)

Tags: [agentic](<https://devfeed.tech/tags/agentic.md>), [agentic-workflows](<https://devfeed.tech/tags/agentic-workflows.md>), [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-ml](<https://devfeed.tech/tags/ai-ml.md>), [analysis](<https://devfeed.tech/tags/analysis.md>), [api](<https://devfeed.tech/tags/api.md>), [blog-post](<https://devfeed.tech/tags/blog-post.md>), [build](<https://devfeed.tech/tags/build.md>), [built-in](<https://devfeed.tech/tags/built-in.md>), [continuous-integration](<https://devfeed.tech/tags/continuous-integration.md>), [meta](<https://devfeed.tech/tags/meta.md>), [microsoft](<https://devfeed.tech/tags/microsoft.md>), [partnership](<https://devfeed.tech/tags/partnership.md>), [protocol](<https://devfeed.tech/tags/protocol.md>), [pylance](<https://devfeed.tech/tags/pylance.md>), [pyrefly](<https://devfeed.tech/tags/pyrefly.md>), [python](<https://devfeed.tech/tags/python.md>), [tsp](<https://devfeed.tech/tags/tsp.md>), [type](<https://devfeed.tech/tags/type.md>), [visual-studio-code](<https://devfeed.tech/tags/visual-studio-code.md>), [vs-code](<https://devfeed.tech/tags/vs-code.md>)

### AI overview

The Type Server Protocol (TSP) separates Pylance's VS Code intelligence features from the type checker, making the checker interchangeable. Pyright remains the default; developers can route diagnostics through Pyrefly while keeping Pylance completions, Quick Info, environment management, and GitHub Copilot integrations. Pylance can detect an installed Pyrefly and offer to switch, or users can select "Pylance + Pyrefly" in settings. The integration requires Pylance 2026.4.1 or newer and Pyrefly 0.60.0 or newer; Pylance can search for or download Pyrefly, and its version can be pinned or set to a local executable. The article says Pyrefly is also available as a standalone VS Code extension and for CI, while Pylance adds Copilot and broader Python tooling integrations.

### Source excerpt

Announcing the Type Server Protocol and our partnership with Meta The post Pylance + Pyrefly: bring your preferred type checker to Visual Studio Code appeared first on Microsoft for Python Developers Blog.

## PyCon US 2026

DevFeed: [PyCon US 2026](<https://devfeed.tech/articles/pycon-us-2026-20348.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/pycon-us-2026/>)

Author: Vedha Ranganathan

Published: 2026-05-14T00:18:13Z

Content type: news

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [Microsoft](<https://devfeed.tech/topics/microsoft.md>), [Azure](<https://devfeed.tech/topics/azure.md>)

Tags: [2026](<https://devfeed.tech/tags/2026.md>), [agent](<https://devfeed.tech/tags/agent.md>), [agent-framework](<https://devfeed.tech/tags/agent-framework.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-search](<https://devfeed.tech/tags/ai-search.md>), [azure](<https://devfeed.tech/tags/azure.md>), [azure-ai](<https://devfeed.tech/tags/azure-ai.md>), [copilot](<https://devfeed.tech/tags/copilot.md>), [foundry](<https://devfeed.tech/tags/foundry.md>), [github](<https://devfeed.tech/tags/github.md>), [github-copilot](<https://devfeed.tech/tags/github-copilot.md>), [hands-on-labs](<https://devfeed.tech/tags/hands-on-labs.md>), [integration](<https://devfeed.tech/tags/integration.md>), [interactive](<https://devfeed.tech/tags/interactive.md>), [labs](<https://devfeed.tech/tags/labs.md>), [meta](<https://devfeed.tech/tags/meta.md>), [microsoft](<https://devfeed.tech/tags/microsoft.md>), [pycon](<https://devfeed.tech/tags/pycon.md>), [python](<https://devfeed.tech/tags/python.md>), [us](<https://devfeed.tech/tags/us.md>)

### AI overview

Microsoft and GitHub will attend PyCon US 2026, May 14-17 in Long Beach, with 10-minute booth labs on GitHub Copilot, Azure DocumentDB, Microsoft Foundry, Microsoft Agent Framework, Azure PostgreSQL, and Azure AI Search. A Saturday 1 p.m. Meta booth demonstration will show Pylance integration with Meta's Pyrefly type checker; the integration is in early preview in the Insiders build, with broader availability planned for later this year.

### Source excerpt

PyCon US 2026 The post PyCon US 2026 appeared first on Microsoft for Python Developers Blog.

## Introducing Apache Arrow Support in mssql-python

DevFeed: [Introducing Apache Arrow Support in mssql-python](<https://devfeed.tech/articles/introducing-apache-arrow-support-in-mssql-python-20347.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/introducing-apache-arrow-support-in-mssql-python/>)

Author: Saumya Garg

Published: 2026-05-04T04:33:00Z

Content type: release

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [apache-arrow](<https://devfeed.tech/topics/apache-arrow.md>), [Python Driver for SQL Server](<https://devfeed.tech/topics/python-driver-for-sql-server.md>), [Python](<https://devfeed.tech/topics/python.md>)

Tags: [abi](<https://devfeed.tech/tags/abi.md>), [all](<https://devfeed.tech/tags/all.md>), [apache-arrow](<https://devfeed.tech/tags/apache-arrow.md>), [arrow](<https://devfeed.tech/tags/arrow.md>), [away](<https://devfeed.tech/tags/away.md>), [azure](<https://devfeed.tech/tags/azure.md>), [azure-sql](<https://devfeed.tech/tags/azure-sql.md>), [blog](<https://devfeed.tech/tags/blog.md>), [buffer](<https://devfeed.tech/tags/buffer.md>), [build](<https://devfeed.tech/tags/build.md>), [client-driver](<https://devfeed.tech/tags/client-driver.md>), [data](<https://devfeed.tech/tags/data.md>), [developers](<https://devfeed.tech/tags/developers.md>), [faster](<https://devfeed.tech/tags/faster.md>), [fetching](<https://devfeed.tech/tags/fetching.md>), [gc](<https://devfeed.tech/tags/gc.md>), [microsoft](<https://devfeed.tech/tags/microsoft.md>), [mssql](<https://devfeed.tech/tags/mssql.md>), [polars](<https://devfeed.tech/tags/polars.md>), [python](<https://devfeed.tech/tags/python.md>), [python-driver-for-azure-sql](<https://devfeed.tech/tags/python-driver-for-azure-sql.md>), [python-driver-for-sql-server](<https://devfeed.tech/tags/python-driver-for-sql-server.md>), [sql](<https://devfeed.tech/tags/sql.md>), [sql-server](<https://devfeed.tech/tags/sql-server.md>), [sql-server-2025](<https://devfeed.tech/tags/sql-server-2025.md>), [support](<https://devfeed.tech/tags/support.md>)

### AI overview

mssql-python now supports fetching SQL Server data into Apache Arrow structures, avoiding creation of a Python object for every row. The excerpt explains that the C++ fetch loop can write values into typed column buffers and expose them through the Arrow C Data Interface, allowing Arrow-native libraries to access the memory without serialization, copying, or reparsing. It presents this as a faster, more memory-efficient path for Polars, Pandas, DuckDB, and other Arrow-native tools, with potential speed gains especially for temporal types; the excerpt cuts off before naming those types or detailing further benefits.

### Source excerpt

Reviewed by Sumit Sarabhai Fetching a million rows from SQL Server into a Polars DataFrame used to mean a million Python objects, a million GC allocations, and then throwing it all away to build a DataFrame. Not anymore. mssql-python now supports fetching SQL Server data directly as Apache Arrow structures - a faster and more [...] The post Introducing Apache Arrow Support in mssql-python appeared first on Microsoft for Python Developers Blog.

## Python Environments Extension for VS Code- April Update

DevFeed: [Python Environments Extension for VS Code- April Update](<https://devfeed.tech/articles/python-environments-extension-for-vs-code-april-update-20349.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/python-in-visual-studio-code-april-2026-release/>)

Author: Vedha Ranganathan

Published: 2026-04-27T20:07:30Z

Content type: release

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [VS Code Extension](<https://devfeed.tech/topics/vscode-extension.md>), [Python](<https://devfeed.tech/topics/python.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [remote-development](<https://devfeed.tech/topics/remote-development.md>), [pip](<https://devfeed.tech/topics/pip.md>)

Tags: [2026](<https://devfeed.tech/tags/2026.md>), [activation](<https://devfeed.tech/tags/activation.md>), [announce](<https://devfeed.tech/tags/announce.md>), [automatically](<https://devfeed.tech/tags/automatically.md>), [backend](<https://devfeed.tech/tags/backend.md>), [base](<https://devfeed.tech/tags/base.md>), [can](<https://devfeed.tech/tags/can.md>), [cause](<https://devfeed.tech/tags/cause.md>), [changes](<https://devfeed.tech/tags/changes.md>), [code](<https://devfeed.tech/tags/code.md>), [conda](<https://devfeed.tech/tags/conda.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [containerized](<https://devfeed.tech/tags/containerized.md>), [covers](<https://devfeed.tech/tags/covers.md>), [environments](<https://devfeed.tech/tags/environments.md>), [extension](<https://devfeed.tech/tags/extension.md>), [python](<https://devfeed.tech/tags/python.md>), [release](<https://devfeed.tech/tags/release.md>), [update](<https://devfeed.tech/tags/update.md>), [vs-code](<https://devfeed.tech/tags/vs-code.md>)

### AI overview

The April 2026 Python Environments extension update targets startup performance and reliability, especially in remote or containerized workspaces. Pipenv, pyenv, and Poetry discovery is deferred until needed; environment resolution is faster, and default virtual environment scanning is narrower to avoid deep workspace scans that could hang PET for 30 seconds or more. Environments nested deeper than one level may require custom search paths. The extension retries refreshes after PET crashes and handles empty or malformed responses, and fixes a Conda base environment restoration issue. Package lists now refresh automatically when metadata changes after package operations. The supplied excerpt begins a section on creating terminals in multi-project workspaces but cuts off before describing the change.

### Source excerpt

The April 2026 release update includes the Python Environments extension... Keep on reading to learn more! The post Python Environments Extension for VS Code- April Update appeared first on Microsoft for Python Developers Blog.

## Write SQL Your Way: Dual Parameter Style Benefits in mssql-python

DevFeed: [Write SQL Your Way: Dual Parameter Style Benefits in mssql-python](<https://devfeed.tech/articles/write-sql-your-way-dual-parameter-style-benefits-in-mssql-python-20356.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/write-sql-your-way-dual-parameter-style-benefits-in-mssql-python/>)

Author: Jahnvi Thakkar

Published: 2026-04-07T16:12:05Z

Content type: release

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [Python Driver for SQL Server](<https://devfeed.tech/topics/python-driver-for-sql-server.md>), [Python](<https://devfeed.tech/topics/python.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [sql-server](<https://devfeed.tech/topics/sql-server.md>), [Python Driver for Azure SQL](<https://devfeed.tech/topics/python-driver-for-azure-sql.md>)

Tags: [azure](<https://devfeed.tech/tags/azure.md>), [azure-sql](<https://devfeed.tech/tags/azure-sql.md>), [client-driver](<https://devfeed.tech/tags/client-driver.md>), [driver](<https://devfeed.tech/tags/driver.md>), [high-performance](<https://devfeed.tech/tags/high-performance.md>), [mssql](<https://devfeed.tech/tags/mssql.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [python](<https://devfeed.tech/tags/python.md>), [python-driver-for-azure-sql](<https://devfeed.tech/tags/python-driver-for-azure-sql.md>), [python-driver-for-sql-server](<https://devfeed.tech/tags/python-driver-for-sql-server.md>), [queries](<https://devfeed.tech/tags/queries.md>), [sql](<https://devfeed.tech/tags/sql.md>), [sql-server](<https://devfeed.tech/tags/sql-server.md>), [sql-server-2025](<https://devfeed.tech/tags/sql-server-2025.md>)

### AI overview

mssql-python now accepts both qmark (`?` placeholders with a tuple or list) and pyformat (`%(name)s` placeholders with a dictionary), selected automatically from the parameter type. Existing qmark code needs no changes. For a dictionary, the driver finds named placeholders while skipping string literals, comments and bracketed identifiers; checks that each has a matching key; converts values into placeholder order, repeating values when a name is reused; then rewrites placeholders to `?` for ODBC. The excerpt presents named parameters as useful for complex queries, reusable values and dynamic filters, and notes compatibility with code using named parameters in other DB-API drivers.

### Source excerpt

Reviewed by: Sumit Sarabhai If you've been writing SQL in Python, you already know the debate: positional parameters (?) or named parameters (%(name)s)? Some developers swear by the conciseness of positional. Others prefer the clarity of named. With mssql-python, you no longer need to choose - we support both. We've added dual parameter style support to mssql-python, enabling both qmark and pyformat parameter styles in Python [...] The post Write SQL Your Way: Dual Parameter Style Benefits in mssql-python appeared first on Microsoft for Python Developers Blog.

## Python in Visual Studio Code - March 2026 Release

DevFeed: [Python in Visual Studio Code - March 2026 Release](<https://devfeed.tech/articles/python-in-visual-studio-code-march-2026-release-20351.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/python-in-visual-studio-code-march-2026-release/>)

Author: Vedha Ranganathan

Published: 2026-04-02T00:27:15Z

Content type: release

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [Python](<https://devfeed.tech/topics/python.md>), [Release notes](<https://devfeed.tech/topics/release-notes.md>)

Tags: [2026](<https://devfeed.tech/tags/2026.md>), [based](<https://devfeed.tech/tags/based.md>), [experimental](<https://devfeed.tech/tags/experimental.md>), [extensions](<https://devfeed.tech/tags/extensions.md>), [intellisense](<https://devfeed.tech/tags/intellisense.md>), [packages](<https://devfeed.tech/tags/packages.md>), [parallel](<https://devfeed.tech/tags/parallel.md>), [performance](<https://devfeed.tech/tags/performance.md>), [pylance](<https://devfeed.tech/tags/pylance.md>), [python](<https://devfeed.tech/tags/python.md>), [release](<https://devfeed.tech/tags/release.md>), [rust](<https://devfeed.tech/tags/rust.md>), [search](<https://devfeed.tech/tags/search.md>), [visual-studio-code](<https://devfeed.tech/tags/visual-studio-code.md>)

### AI overview

The March 2026 Python and Pylance release adds opt-in search of symbols from packages in the active virtual environment and an experimental parallel indexer. Enabling "Python › Analysis: Include Venv In Workspace Symbols" lets Workspace Symbol search find third-party definitions without leaving VS Code; for libraries without [detail omitted in the excerpt], only symbols exported via [details omitted] are included. Package Index Depths can limit how deeply Pylance searches. The feature is opt-in because indexing can affect performance. "Python › Analysis: Enable Parallel Indexing" switches indexing for completions, auto-imports, and symbol search to an out-of-process Rust implementation. Microsoft reports an average 10x speedup on large projects in its testing, but says the experimental feature still needs validation across project setups and environments.

### Source excerpt

The March 2026 release of the Python and Jupyter extensions for Visual Studio Code is now available. Keep on reading to learn more! The post Python in Visual Studio Code - March 2026 Release appeared first on Microsoft for Python Developers Blog.

## Python Environments Extension for VS Code

DevFeed: [Python Environments Extension for VS Code](<https://devfeed.tech/articles/python-environments-extension-for-vs-code-20350.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/python-in-visual-studio-code-february-2026-release/>)

Author: Vedha Ranganathan

Published: 2026-02-18T22:00:22Z

Content type: release

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [VS Code Extension](<https://devfeed.tech/topics/vscode-extension.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [Python](<https://devfeed.tech/topics/python.md>), [Tool](<https://devfeed.tech/topics/tool.md>)

Tags: [button](<https://devfeed.tech/tags/button.md>), [community-feedback](<https://devfeed.tech/tags/community-feedback.md>), [conda](<https://devfeed.tech/tags/conda.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [development](<https://devfeed.tech/tags/development.md>), [discovery](<https://devfeed.tech/tags/discovery.md>), [engine](<https://devfeed.tech/tags/engine.md>), [environments](<https://devfeed.tech/tags/environments.md>), [extension](<https://devfeed.tech/tags/extension.md>), [faster](<https://devfeed.tech/tags/faster.md>), [general-availability](<https://devfeed.tech/tags/general-availability.md>), [packages](<https://devfeed.tech/tags/packages.md>), [palette](<https://devfeed.tech/tags/palette.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [poetry](<https://devfeed.tech/tags/poetry.md>), [python](<https://devfeed.tech/tags/python.md>), [real-world](<https://devfeed.tech/tags/real-world.md>), [rust](<https://devfeed.tech/tags/rust.md>), [scanner](<https://devfeed.tech/tags/scanner.md>), [vs-code](<https://devfeed.tech/tags/vs-code.md>)

### AI overview

The Python Environments extension for VS Code is rolling out for general availability after a year in preview. It works alongside the Python extension and discovers environments automatically, using PET to scan PATH, known locations, and configurable search paths. A single UI lets users create, delete, switch, and manage environments from venv, conda, pyenv, poetry, pipenv, and system Python installs. Users can add search paths for environments in non-standard locations. When uv is installed, it is used by default to create venv environments and install packages, which the excerpt describes as significantly faster than standard tools, especially in large projects. Quick Create uses the default manager, latest Python version, and workspace dependencies it finds; Custom Create offers choices including manager, Python version, and environment name. The excerpt cuts off before the Custom Create details are complete.

### Source excerpt

The February 2026 release This release includes the Python Environments extension... Keep on reading to learn more! The post Python Environments Extension for VS Code appeared first on Microsoft for Python Developers Blog.

## Python in Visual Studio Code - October 2025 Release

DevFeed: [Python in Visual Studio Code - October 2025 Release](<https://devfeed.tech/articles/python-in-visual-studio-code-october-2025-release-20353.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/python-in-visual-studio-code-october-2025-release/>)

Author: Luciana Abud

Published: 2025-10-10T17:55:26Z

Content type: release

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [Python](<https://devfeed.tech/topics/python.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [.NET](<https://devfeed.tech/topics/net.md>)

Tags: [2025](<https://devfeed.tech/tags/2025.md>), [activation](<https://devfeed.tech/tags/activation.md>), [chat](<https://devfeed.tech/tags/chat.md>), [copilot](<https://devfeed.tech/tags/copilot.md>), [copy](<https://devfeed.tech/tags/copy.md>), [environment](<https://devfeed.tech/tags/environment.md>), [environments](<https://devfeed.tech/tags/environments.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extensions](<https://devfeed.tech/tags/extensions.md>), [id](<https://devfeed.tech/tags/id.md>), [improvements](<https://devfeed.tech/tags/improvements.md>), [jupyter](<https://devfeed.tech/tags/jupyter.md>), [october](<https://devfeed.tech/tags/october.md>), [performance](<https://devfeed.tech/tags/performance.md>), [python](<https://devfeed.tech/tags/python.md>), [release](<https://devfeed.tech/tags/release.md>), [test](<https://devfeed.tech/tags/test.md>), [visual-studio-code](<https://devfeed.tech/tags/visual-studio-code.md>)

### AI overview

The October 2025 Python extensions release for VS Code improves Python environment handling, test workflows, and shell activation. The Python Environments extension adds automatic manager refresh when expanding tree nodes, sorts Python versions newest first, and includes fixes for conda performance and reliability, crashes, and false-positive configuration warnings. A gutter menu option copies a test function's identifier in pytest format for running or sharing specific tests. Shell startup changes aim to make virtual environment activation more reliable in terminals created by GitHub Copilot, reduce repeated permission prompts, display environment prompts through PowerShell shell integration, and resolve WSL activation issues. The excerpt says a VS Code setting must be changed to use the startup improvements, but the setting name and value are missing.

### Source excerpt

The October 2025 release of the Python and Jupyter extensions for Visual Studio Code are now available. This release includes improvements to the Python Environments extension, Copy Test ID functionality, and enhanced environment activation when using Copilot Chat. Keep on reading to learn more! The post Python in Visual Studio Code - October 2025 Release appeared first on Microsoft for Python Developers Blog.

## Simplifying Resource Management in mssql-python through Context Manager

DevFeed: [Simplifying Resource Management in mssql-python through Context Manager](<https://devfeed.tech/articles/simplifying-resource-management-in-mssql-python-through-context-manager-20355.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/python/simplifying-resource-management-in-mssql-python-through-context-manager/>)

Author: Jahnvi Thakkar

Published: 2025-09-26T09:49:51Z

Content type: tutorial

Language: en

Sources: [Microsoft Python Engineering](<https://devfeed.tech/sources/microsoft-python-engineering.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [sql-server](<https://devfeed.tech/topics/sql-server.md>), [Database](<https://devfeed.tech/topics/database.md>), [Exception](<https://devfeed.tech/topics/exception.md>)

Tags: [azure](<https://devfeed.tech/tags/azure.md>), [azure-sql](<https://devfeed.tech/tags/azure-sql.md>), [cleanup](<https://devfeed.tech/tags/cleanup.md>), [client-driver](<https://devfeed.tech/tags/client-driver.md>), [databases](<https://devfeed.tech/tags/databases.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [python](<https://devfeed.tech/tags/python.md>), [python-driver-for-azure-sql](<https://devfeed.tech/tags/python-driver-for-azure-sql.md>), [python-driver-for-sql-server](<https://devfeed.tech/tags/python-driver-for-sql-server.md>), [sql-server](<https://devfeed.tech/tags/sql-server.md>), [sql-server-2025](<https://devfeed.tech/tags/sql-server-2025.md>), [transactions](<https://devfeed.tech/tags/transactions.md>)

### AI overview

This tutorial explains context manager support in the mssql-python driver for Python applications using SQL Server and Azure SQL. It describes how context managers manage connections and cursors, commit successful transactions, roll back transactions when exceptions occur, and close connections automatically.

### Source excerpt

Reviewed by: Sumit Sarabhai and Gaurav Sharma If you've worked with databases in Python, you know the boilerplate: open a connection, create a cursor, run queries, commit or rollback transactions, close cursors and connection. Forgetting just one cleanup step can lead to resource leaks (open connections) or even inconsistent data. That's where context managers step [...] The post Simplifying Resource Management in mssql-python through Context Manager appeared first on Microsoft for Python Developers Blog.