Skip to content

Commit 2713de4

Browse files
committed
Merge branch 'main' of https://github.com/microsoft/mssql-python into release/1.0.0
2 parents 30e79e0 + e185841 commit 2713de4

File tree

2 files changed

+58
-77
lines changed

2 files changed

+58
-77
lines changed

README.md

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The driver is compatible with all the Python versions >= 3.10
77
[Documentation](https://github.com/microsoft/mssql-python/wiki) | [Release Notes](https://github.com/microsoft/mssql-python/releases) | [Roadmap](https://github.com/microsoft/mssql-python/blob/main/ROADMAP.md)
88

99
> **Note:**
10-
> This project is currently in Public Preview, meaning it is still under active development. We are working on core functionalities and gathering more feedback before GA. Please use with caution and avoid production environments.
10+
> This project is now Generally Available (GA) and ready for production use. We’ve completed core functionality and incorporated feedback from the preview phase.
1111
>
1212
## Installation
1313

@@ -47,20 +47,8 @@ pip install mssql-python
4747
Windows, MacOS and Linux (manylinux - Debian, Ubuntu, RHEL, SUSE (x64 only) & musllinux - Alpine)
4848

4949
> **Note:**
50-
> SUSE Linux ARM64 is not supported by Microsoft ODBC Driver. Use x64 architecture for SUSE deployments.
51-
52-
### DBAPI v2.0 Compliance
53-
54-
The Microsoft **mssql-python** module is designed to be fully compliant with the DB API 2.0 specification. This ensures that the driver adheres to a standardized interface for database access in Python, providing consistency and reliability across different database systems. Key aspects of DBAPI v2.0 compliance include:
55-
56-
- **Connection Objects**: Establishing and managing connections to the database.
57-
- **Cursor Objects**: Executing SQL commands and retrieving results.
58-
- **Transaction Management**: Supporting commit and rollback operations to ensure data integrity.
59-
- **Error Handling**: Providing a consistent set of exceptions for handling database errors.
60-
- **Parameter Substitution**: Allowing the use of placeholders in SQL queries to prevent SQL injection attacks.
61-
62-
By adhering to the DB API 2.0 specification, the mssql-python module ensures compatibility with a wide range of Python applications and frameworks, making it a versatile choice for developers working with Microsoft SQL Server, Azure SQL Database, and Azure SQL Managed Instance.
63-
50+
> SUSE Linux ARM64 is not supported. Please use x64 architecture for SUSE deployments.
51+
6452
### Support for Microsoft Entra ID Authentication
6553

6654
The Microsoft mssql-python driver enables Python applications to connect to Microsoft SQL Server, Azure SQL Database, or Azure SQL Managed Instance using Microsoft Entra ID identities. It supports a variety of authentication methods, including username and password, Microsoft Entra managed identity (system-assigned and user-assigned), Integrated Windows Authentication in a federated, domain-joined environment, interactive authentication via browser, device code flow for environments without browser access, and the default authentication method based on environment and configuration. This flexibility allows developers to choose the most suitable authentication approach for their deployment scenario.
@@ -73,39 +61,65 @@ EntraID authentication is now fully supported on MacOS and Linux but with certai
7361
| ActiveDirectoryInteractive | ✅ Yes | ✅ Yes | Interactive login via browser; requires user interaction |
7462
| ActiveDirectoryMSI (Managed Identity) | ✅ Yes | ✅ Yes | For Azure VMs/containers with managed identity |
7563
| ActiveDirectoryServicePrincipal | ✅ Yes | ✅ Yes | Use client ID and secret or certificate |
76-
| ActiveDirectoryIntegrated | ✅ Yes | ❌ No | Only works on Windows (requires Kerberos/SSPI) |
64+
| ActiveDirectoryIntegrated | ✅ Yes | ✅ Yes | Now supported on Windows, macOS, and Linux (requires Kerberos/SSPI or equivalent configuration) |
7765
| ActiveDirectoryDeviceCode | ✅ Yes | ✅ Yes | Device code flow for authentication; suitable for environments without browser access |
7866
| ActiveDirectoryDefault | ✅ Yes | ✅ Yes | Uses default authentication method based on environment and configuration |
7967

8068
> For more information on Entra ID please refer this [document](https://github.com/microsoft/mssql-python/wiki/Microsoft-Entra-ID-support)
8169
82-
### Enhanced Pythonic Features
83-
84-
The driver offers a suite of Pythonic enhancements that streamline database interactions, making it easier for developers to execute queries, manage connections, and handle data more efficiently.
85-
8670
### Connection Pooling
8771

8872
The Microsoft mssql_python driver provides built-in support for connection pooling, which helps improve performance and scalability by reusing active database connections instead of creating a new connection for every request. This feature is enabled by default. For more information, refer [Connection Pooling Wiki](https://github.com/microsoft/mssql-python/wiki/Connection#connection-pooling).
73+
74+
### DBAPI v2.0 Compliance
75+
76+
The Microsoft **mssql-python** module is designed to be fully compliant with the DB API 2.0 specification. This ensures that the driver adheres to a standardized interface for database access in Python, providing consistency and reliability across different database systems. Key aspects of DBAPI v2.0 compliance include:
77+
78+
- **Connection Objects**: Establishing and managing connections to the database.
79+
- **Cursor Objects**: Executing SQL commands and retrieving results.
80+
- **Transaction Management**: Supporting commit and rollback operations to ensure data integrity.
81+
- **Error Handling**: Providing a consistent set of exceptions for handling database errors.
82+
- **Parameter Substitution**: Allowing the use of placeholders in SQL queries to prevent SQL injection attacks.
83+
84+
By adhering to the DB API 2.0 specification, the mssql-python module ensures compatibility with a wide range of Python applications and frameworks, making it a versatile choice for developers working with Microsoft SQL Server, Azure SQL Database, and Azure SQL Managed Instance.
85+
86+
### Enhanced Pythonic Features
87+
88+
The driver offers a suite of Pythonic enhancements that streamline database interactions, making it easier for developers to execute queries, manage connections, and handle data more efficiently.
8989

9090
## Getting Started Examples
9191
Connect to SQL Server and execute a simple query:
9292

9393
```python
9494
import mssql_python
95-
95+
9696
# Establish a connection
97-
# Specify connection string
98-
connection_string = "SERVER=<your_server_name>;DATABASE=<your_database_name>;UID=<your_user_name>;PWD=<your_password>;Encrypt=yes;"
97+
# Specify connection string (semicolon-delimited key=value format preserved)
98+
# Uses Azure Entra ID Interactive authentication — no password in the string.
99+
connection_string = "SERVER=tcp:mssql-python-driver-eastus01.database.windows.net,1433;DATABASE=AdventureWorksLT;Authentication=ActiveDirectoryInteractive;Encrypt=yes;"
99100
connection = mssql_python.connect(connection_string)
100-
101-
# Execute a query
101+
102+
# Execute a realistic query against AdventureWorksLT:
103+
# Top 10 customers by number of orders, with their total spend
102104
cursor = connection.cursor()
103-
cursor.execute("SELECT * from customer")
105+
cursor.execute("""
106+
SELECT TOP 10
107+
c.CustomerID,
108+
c.FirstName,
109+
c.LastName,
110+
COUNT(h.SalesOrderID) AS OrderCount,
111+
SUM(h.TotalDue) AS TotalSpend
112+
FROM SalesLT.Customer AS c
113+
INNER JOIN SalesLT.SalesOrderHeader AS h
114+
ON c.CustomerID = h.CustomerID
115+
GROUP BY c.CustomerID, c.FirstName, c.LastName
116+
ORDER BY OrderCount DESC, TotalSpend DESC
117+
""")
104118
rows = cursor.fetchall()
105-
119+
106120
for row in rows:
107121
print(row)
108-
122+
109123
# Close the connection
110124
connection.close()
111125

ROADMAP.md

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,18 @@
11
# Roadmap for Python Driver for SQL Server
22

3-
We are thrilled to introduce Python driver for SQL Server (Public Preview) – a modern, high performant, and developer-friendly SDK designed to enhance your SQL Server database connectivity experience. This roadmap outlines the key structural improvements, new features and upcoming enhancements that will set our driver apart from existing solutions.
4-
5-
Why a New Driver?
6-
7-
Unlike existing Python SQL Server drivers, we are making substantial improvements to performance, maintainability, and usability by re-architecting the core internals. Our focus is on seamless integration between Python and C++, efficient memory management, better state handling, and advanced DBAPI enhancements.
8-
9-
Here’s what’s coming:
10-
11-
**1. Structural changes for abstraction of C++ and Python codebase**
12-
13-
We are undertaking significant structural changes to provide a clear abstraction between C++ code and Python. This will ensure better maintainability, improved performance, and a cleaner codebase. By leveraging existing pybind11 module, we aim to create a seamless integration between the two languages, allowing for efficient execution and easier debugging.
14-
15-
This will improve:
16-
- Maintainability via simplified modular architecture
17-
- Performance via optimized C++ code
18-
- Debugging, traceability and seamless interaction between C++ and Python via with PyBind11 module integration
19-
20-
**2. Future DBAPI Enhancements**
21-
22-
In future releases, we plan to add several DBAPI enhancements, including:
23-
- `Callproc()` : Support for calling stored procedures.
24-
- `setinputsize()` and `setoutputsize()`
25-
- `Output` and `InputOutput` Parameters: Handling of output and input-output parameters in stored procedures.
26-
- Optional DBAPIs: Additional optional DBAPI features to provide more flexibility and functionality for developers.
27-
28-
**3. Cross-Platform Support: Additional Linux Distributions**
29-
30-
We are committed to providing cross-platform support for our Python driver. In the next few weeks, we will release support for additional Linux distributions viz Alpine, SUSE Linux & Oracle Linux.
31-
32-
**4. Bulk Copy (BCP)**
33-
34-
Bulk Copy API (BCP) support is coming soon to the Python Driver for SQL Server. It enables high-speed data ingestion and offers fine-grained control over batch operations, making it ideal for large-scale ETL workflows.
35-
36-
**5. Asynchronous Query Execution**
37-
38-
We are also working on adding support for asynchronous query execution. This feature will allow developers to execute queries without blocking the main thread, enabling more responsive and efficient applications. Asynchronous query execution will be particularly beneficial for applications that require high concurrency and low latency.
39-
- No blocking of the main thread
40-
- Faster parallel processing – ideal for high-concurrency applications
41-
- Better integration with async frameworks like asyncio
42-
43-
We are dedicated to continuously improving the Python driver for SQL Server and welcome feedback from the community. Stay tuned for updates and new features as we work towards delivering a high-quality driver that meets your needs.
44-
Join the Conversation!
45-
46-
We are building this for developers, with developers. Your feedback will shape the future of the driver.
47-
- Follow our [Github Repo](https://github.com/microsoft/mssql-python)
48-
- Join Discussions – Share your ideas and suggestions
49-
- Try our alpha release – Help us refine and optimize the experience
50-
51-
Stay tuned for more updates, and lets build something amazing together. Watch this space for announcements and release timelines.
3+
The following roadmap summarizes the features planned for the Python Driver for SQL Server.
4+
5+
| Feature | Description | Status | Target Timeline |
6+
| ------------------------------ | ----------------------------------------------------------------- | ------------ | ------------------------ |
7+
| Parameter Dictionaries | Allow parameters to be supplied as Python dicts | Planned | Q4 2025 |
8+
| Return Rows as Dictionaries | Fetch rows as dictionaries for more Pythonic access | Planned | Q4 2025 |
9+
| Bulk Copy (BCP) | High-throughput ingestion API for ETL workloads | Under Design | Q1 2026 |
10+
| Asynchronous Query Execution | Non-blocking queries with asyncio support | Planned | Q1 2026 |
11+
| Vector Datatype Support | Native support for SQL Server vector datatype | Planned | Q1 2026 |
12+
| Table-Valued Parameters (TVPs) | Pass tabular data structures into stored procedures | Planned | Q1 2026 |
13+
| C++ Abstraction | Modular separation via pybind11 for performance & maintainability | In Progress | ETA will be updated soon |
14+
| JSON Datatype Support | Automatic mapping of JSON datatype to Python dicts/lists | Planned | ETA will be updated soon |
15+
| callproc() | Full DBAPI compliance & stored procedure enhancements | Planned | ETA will be updated soon |
16+
| setinputsize() | Full DBAPI compliance & stored procedure enhancements | Planned | ETA will be updated soon |
17+
| setoutputsize() | Full DBAPI compliance & stored procedure enhancements | Planned | ETA will be updated soon |
18+
| Output/InputOutput Params | Full DBAPI compliance & stored procedure enhancements | Planned | ETA will be updated soon |

0 commit comments

Comments
 (0)