Skip to content

Commit 2eb761c

Browse files
committed
merge conflict resolved
2 parents 899eb53 + 448e9a9 commit 2eb761c

16 files changed

+2507
-1993
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ""
5+
labels: [":new: Triage Needed", ":bug: Bug!"]
6+
assignees: []
7+
8+
---
9+
10+
### Describe the bug
11+
A clear and concise description of what the bug is.
12+
13+
If you are seeing an exception, include the full exceptions details (message and stack trace).
14+
15+
```
16+
Exception message:
17+
Stack trace:
18+
```
19+
20+
### To reproduce
21+
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
22+
23+
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.
24+
25+
```python
26+
print("Hello World!")
27+
```
28+
29+
### Expected behavior
30+
A clear and concise description of what you expected to happen.
31+
32+
### Further technical details
33+
Python version:
34+
SQL Server version: (e.g. SQL Server 2022)
35+
Operating system: (e.g. Windows Server 2022, Ubuntu 24.04, macOS 14.7.1, Docker container)
36+
37+
**Additional context**
38+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Python Community Support / Discussions
4+
url: https://github.com/microsoft/mssql-python/discussions
5+
about: Please ask and answer questions here.
6+
- name: MSRC Vulnerability Reporting / Bug Bounty
7+
url: https://msrc.microsoft.com/create-report
8+
about: Please report security vulnerabilities here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ""
5+
labels: [":new: Triage Needed", ":bulb: Enhancement"]
6+
assignees: []
7+
8+
---
9+
10+
### Is your feature request related to a problem? Please describe.
11+
A clear and concise description of what the problem is.
12+
13+
### Describe the solution you'd like
14+
A clear and concise description of what you want to happen.
15+
16+
### Describe alternatives you've considered
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
### Additional context
20+
Add any other context about the feature request here.

.github/ISSUE_TEMPLATE/other.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Other
3+
about: Ask a question or file a different type of issue
4+
title: ""
5+
labels: [":new: Triage Needed"]
6+
assignees: []
7+
8+
---

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
### Added
10+
- New feature: Support for macOS and Linux.
11+
- Documentation: Added API documentation in the Wiki.
12+
13+
### Changed
14+
- Improved error handling in the connection module.
15+
16+
### Fixed
17+
- Bug fix: Resolved issue with connection timeout.
18+
19+
## [1.0.0-alpha] - 2025-02-24
20+
21+
### Added
22+
- Initial release of the mssql-python driver for SQL Server.
23+
24+
### Changed
25+
- N/A
26+
27+
### Fixed
28+
- N/A

CODE_OF_CONDUCT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4+
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Contributing to mssql-python
2+
3+
This project welcomes contributions and suggestions. Most contributions require you to
4+
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
5+
and actually do, grant us the rights to use your contribution. For details, visit
6+
https://cla.microsoft.com.
7+
8+
When you submit a pull request, a CLA-bot will automatically determine whether you need
9+
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
10+
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
11+
12+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
13+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
14+
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

LICENSE

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
MIT License
2+
All files licensed under the MIT license except the dynamic-link libraries (DLLs) in the mssql_python\libs\win folder,
3+
which are subject to different licensing terms. Please review the licensing details for each component below.
4+
5+
A. MIT License
6+
==================================================================
7+
Copyright (c) Microsoft Corporation.
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in all
17+
copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
SOFTWARE
26+
27+
28+
B. MICROSOFT LICENSES
29+
==================================================================
30+
The following dynamic-link libraries (DLLs) in the mssql_python\libs\win folder fall under different Microsoft licenses.
31+
Below is a breakdown of these components by their respective licenses.
32+
33+
1. Microsoft ODBC Driver 18 End User License Agreement (EULA)
34+
These components are part of the Microsoft ODBC Driver 18 for SQL Server and are governed by the Microsoft ODBC Driver 18 EULA.
35+
36+
- msodbcsqlr18.rll: Resource library containing localized error messages for the ODBC driver.
37+
- msodbcdiag18.dll: Diagnostic library for handling error reporting and troubleshooting.
38+
- msodbcsql18.dll: Core ODBC driver enabling connectivity between SQL Server and applications.
39+
40+
For official licensing terms, refer to: mssql_python\libs\win\MICROSOFT_ODBC_DRIVER_FOR_SQL_SERVER_LICENSE.txt
41+
42+
2. Microsoft Visual C++ Redistributable EULA
43+
These components are part of the Microsoft Visual C++ Redistributable and are governed by the Microsoft Visual C++ Redistributable EULA.
44+
45+
- msvcp140.dll: Microsoft C++ Standard Library runtime, required for running C++ applications.
46+
47+
For redistribution and usage terms, refer to: mssql_python\libs\win\libs\win\MICROSOFT_VISUAL_STUDIO_LICENSE.txt

README.md

Lines changed: 91 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,100 @@
1-
# mssql-python
1+
# Microsoft Python Driver for SQL Server
22

3-
This is a new Python driver for Microsoft SQL Server currently in Alpha phase.
3+
**mssql-python** is a Python driver for Microsoft SQL Server and the Azure SQL family of databases. It leverages Direct Database Connectivity (DDBC) that enables direct connections to SQL Server without requiring an external driver manager. Designed to comply with the [DB API 2.0](https://peps.python.org/pep-0249/) specification, this driver also introduces Pythonic enhancements for improved usability and functionality. It supports a full range of database operations, including connection management, query execution, and transaction handling.
44

5-
## Alpha Version Release
5+
[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)
66

7-
We are excited to announce the release of the alpha version of our driver. This marks a significant milestone in our development journey. While this version is still in the early stages, it includes the foundational code and initial logic that will drive future enhancements.
7+
> **Note:**
8+
> This project is currently in an alpha phase, meaning it is still under active development. We are looking to validate core functionalities and gather initial feedback before a broader public launch. Please use with caution and avoid production environments.
9+
>
10+
## Installation
811

9-
### What's Included:
12+
mssql-python can be installed with [pip](http://pypi.python.org/pypi/pip)
13+
```bash
14+
pip install mssql-python
15+
```
16+
## Key Features
17+
### Supported Platforms
1018

11-
Basic functionality to get you started
12-
Initial implementation of core features
13-
Placeholder for future improvements and updates
19+
Windows
1420

15-
### What's Next:
21+
> **Note:**
22+
> Support for macOS and Linux is coming soon
23+
>
1624
17-
As we continue to develop and refine the driver, you can expect regular updates that will introduce new features, optimizations, and bug fixes. We encourage you to provide feedback and report any issues you encounter, as this will help us improve the driver for the final release.
25+
### DBAPI v2.0 Compliance
1826

19-
### Stay Tuned:
27+
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:
2028

21-
We appreciate your interest and support in this project. Stay tuned for more updates and enhancements as we work towards delivering a robust and fully-featured driver in coming months.
22-
Thank you for being a part of our journey!
29+
- **Connection Objects**: Establishing and managing connections to the database.
30+
- **Cursor Objects**: Executing SQL commands and retrieving results.
31+
- **Transaction Management**: Supporting commit and rollback operations to ensure data integrity.
32+
- **Error Handling**: Providing a consistent set of exceptions for handling database errors.
33+
- **Parameter Substitution**: Allowing the use of placeholders in SQL queries to prevent SQL injection attacks.
34+
35+
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.
36+
37+
### Support for Microsoft Entra ID Authentication
38+
39+
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 various authentication methods, including username and password, Microsoft Entra managed identity, and Integrated Windows Authentication in a federated, domain-joined environment. Additionally, the driver supports Microsoft Entra interactive authentication and Microsoft Entra managed identity authentication for both system-assigned and user-assigned managed identities.
40+
41+
### Enhanced Pythonic Features
42+
43+
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.
44+
45+
## Getting Started Examples
46+
47+
Connect to SQL Server and execute a simple query:
48+
49+
```python
50+
import mssql_python
51+
52+
# Establish a connection
53+
# Specify connection string
54+
connection_string = "SERVER=<your_server_name>;DATABASE=<your_database_name>;UID=<your_user_name>;PWD=<your_password>;Encrypt=yes;"
55+
connection = mssql_python.connect(connection_string)
56+
57+
# Execute a query
58+
cursor = connection.cursor()
59+
cursor.execute("SELECT * from customer")
60+
rows = cursor.fetchall()
61+
62+
for row in rows:
63+
print(row)
64+
65+
# Close the connection
66+
connection.close()
67+
68+
```
69+
70+
## Still have questions?
71+
72+
Check out our [FAQ](https://github.com/microsoft/mssql-python/wiki/Frequently-Asked-Questions). Still not answered? Create an [issue](https://github.com/microsoft/mssql-python/issues/new/choose) to ask a question.
73+
74+
## Contributing
75+
76+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
77+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
78+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
79+
80+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
81+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
82+
provided by the bot. You will only need to do this once across all repos using our CLA.
83+
84+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
85+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
86+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
87+
88+
## License
89+
The mssql-python driver for SQL Server is licensed under the MIT license, except the dynamic-link libraries (DLLs) in the [libs](https://github.com/microsoft/mssql-python/tree/alphaChanges/mssql_python/libs) folder
90+
that are licensed under MICROSOFT SOFTWARE LICENSE TERMS.
91+
92+
Please review the [LICENSE](LICENSE) file for more details.
93+
94+
## Trademarks
95+
96+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
97+
trademarks or logos is subject to and must follow
98+
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
99+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
100+
Any use of third-party trademarks or logos are subject to those third-party's policies.

ROADMAP.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Roadmap for Python Driver for SQL Server
2+
3+
We are thrilled to introduce our upcoming Python driver for SQL Server – 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+
12+
**1. Structural changes for abstraction of C++ and Python codebase**
13+
14+
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.
15+
16+
This will improve:
17+
- Maintainability via simplified modular architecture
18+
- Performance via optimized C++ code
19+
- Debugging, traceability and seamless interaction between C++ and Python via with PyBind11 module integration
20+
21+
**2. Future DBAPI Enhancements**
22+
23+
In future releases, we plan to add several DBAPI enhancements, including:
24+
- `Callproc()` : Support for calling stored procedures.
25+
- `setinputsize()` and `setoutputsize()`
26+
- `Output` and `InputOutput` Parameters: Handling of output and input-output parameters in stored procedures.
27+
- Optional DBAPIs: Additional optional DBAPI features to provide more flexibility and functionality for developers.
28+
29+
**3. Connection Pooling**
30+
31+
Connection pooling will be made available soon, allowing for efficient reuse of database connections. This feature will significantly improve performance by reducing the overhead associated with establishing new connections for each database operation .
32+
- Reduce Connection creation overhead
33+
- Improve scalability via efficient reuse of connections
34+
- Enhance multi-threaded operation performance
35+
36+
**4. Cross-Platform Support: MacOS and Linux Distributions**
37+
38+
We are committed to providing cross-platform support for our Python driver. In the next few months, we will release versions compatible with MacOS and various Linux distributions. This will enable developers to use the driver on their preferred operating systems without any compatibility issues.
39+
Soon, you will be able to:
40+
- Use the driver across multiple environments and OS
41+
- Deploy application on cloud-native platforms
42+
- Avoid compatibility issues with system-dependent code
43+
- Flexibility in choosing development environments
44+
45+
**5. Asynchronous Query Execution**
46+
47+
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 .
48+
- No blocking of the main thread
49+
- Faster parallel processing – ideal for high-concurrency applications
50+
- Better integration with async frameworks like asyncio
51+
52+
53+
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.
54+
Join the Conversation!
55+
56+
We are building this for developers, with developers. Your feedback will shape the future of the driver.
57+
- Follow our [Github Repo](https://github.com/microsoft/mssql-python)
58+
- Join Discussions – Share your ideas and suggestions
59+
- Try our alpha release – Help us refine and optimize the experience
60+
61+
Stay tuned for more updates, and lets build something amazing together. Watch this space for announcements and release timelines.
62+
63+
64+

0 commit comments

Comments
 (0)