Skip to content

Commit 49a04c3

Browse files
authored
RELEASE: 0.13.0 (#269)
### Work Item / Issue Reference <!-- IMPORTANT: Please follow the PR template guidelines below. For mssql-python maintainers: Insert your ADO Work Item ID below (e.g. AB#37452) For external contributors: Insert Github Issue number below (e.g. #149) Only one reference is required - either GitHub issue OR ADO Work Item. --> <!-- mssql-python maintainers: ADO Work Item --> > [AB#39062](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/39062) ------------------------------------------------------------------- ### Summary <!-- Insert your summary of changes below. Minimum 10 characters required. --> This pull request updates the package to version 0.13.0 and revises the release notes to highlight new features and critical stability improvements. The most important changes are grouped below: Version update: * Updated the package version from `0.12.0` to `0.13.0` in `setup.py` to reflect the latest release. Release notes and feature enhancements (in `PyPI_Description.md`): * Added support for streaming large values (NVARCHAR/VARCHAR/VARBINARY(MAX)) in `executemany()` with automatic Data-At-Execution detection and fallback, enabling efficient handling of massive datasets. * Improved batch operations with complete support for UNIQUEIDENTIFIER and DATETIMEOFFSET in `executemany()`, including automatic type inference for bulk inserts of UUIDs and timezone-aware datetimes. * Enhanced cursor reliability by improving `cursor.rowcount` accuracy for all fetch operations, including proper handling of empty result sets and consistent behavior for SELECT, INSERT, and UPDATE. * Addressed critical stability issues by resolving memory leaks, fixing resource cleanup to prevent segmentation faults during Python shutdown, and correcting type inference bugs in batch operations. <!-- ### PR Title Guide > For feature requests FEAT: (short-description) > For non-feature requests like test case updates, config updates , dependency updates etc CHORE: (short-description) > For Fix requests FIX: (short-description) > For doc update requests DOC: (short-description) > For Formatting, indentation, or styling update STYLE: (short-description) > For Refactor, without any feature changes REFACTOR: (short-description) > For release related changes, without any feature changes RELEASE: #<RELEASE_VERSION> (short-description) ### Contribution Guidelines External contributors: - Create a GitHub issue first: https://github.com/microsoft/mssql-python/issues/new - Link the GitHub issue in the "GitHub Issue" section above - Follow the PR title format and provide a meaningful summary mssql-python maintainers: - Create an ADO Work Item following internal processes - Link the ADO Work Item in the "ADO Work Item" section above - Follow the PR title format and provide a meaningful summary -->
1 parent 6af4610 commit 49a04c3

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

PyPI_Description.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ PyBind11 provides:
3939

4040
We are currently in **Public Preview**.
4141

42-
## What's new in v0.12.0
42+
## What's new in v0.13.0
4343

44-
- **Complex Data Type Support:** Added native support for DATETIMEOFFSET and UNIQUEIDENTIFIER data types with full round-trip handling, enabling seamless integration with Python's timezone-aware `datetime` objects and `uuid.UUID` types.
45-
- **Support for monetary or currency values data types:** Extended MONEY and SMALLMONEY support to `executemany` operations with proper NULL handling and decimal conversion for improved bulk financial data processing.
46-
- **Improved Database Metadata API:** Added `getinfo()` method with enhanced ODBC metadata retrieval, allowing users to query driver/data source information using ODBC info types.
47-
- **Data Processing Optimizations:** Removed aggressive datetime parsing to prevent incorrect type conversions and improve data integrity across diverse datetime formats and string data.
44+
- **Enhanced Batch Operations:** Complete support for UNIQUEIDENTIFIER and DATETIMEOFFSET in `executemany()` operations with automatic type inference, enabling efficient bulk inserts of complex data types including UUIDs and timezone-aware datetimes.
45+
- **Streaming Large Values:** Robust handling of large objects (NVARCHAR/VARCHAR/VARBINARY(MAX)) in `executemany()` with automatic Data-At-Execution detection and fallback, supporting streaming inserts and fetches for massive datasets.
46+
- **Improved Cursor Reliability:** Enhanced `cursor.rowcount` accuracy across all fetch operations, including proper handling of empty result sets and consistent behavior for SELECT, INSERT, and UPDATE operations.
47+
- **Critical Stability Fixes:** Resolved memory leaks with secure token buffer handling, fixed resource cleanup to prevent segmentation faults during Python shutdown, and corrected type inference bugs in batch operations.
4848

4949
For more information, please visit the project link on Github: https://github.com/microsoft/mssql-python
5050

mssql_python/pybind/ddbc_bindings.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,8 +2069,10 @@ SQLRETURN BindParameterArray(SQLHANDLE hStmt,
20692069
SQLGUID* guidArray = AllocateParamBufferArray<SQLGUID>(tempBuffers, paramSetSize);
20702070
strLenOrIndArray = AllocateParamBufferArray<SQLLEN>(tempBuffers, paramSetSize);
20712071

2072-
static py::module_ uuid_mod = py::module_::import("uuid");
2073-
static py::object uuid_class = uuid_mod.attr("UUID");
2072+
// Get cached UUID class from module-level helper
2073+
// This avoids static object destruction issues during Python finalization
2074+
py::object uuid_class = py::module_::import("mssql_python.ddbc_bindings").attr("_get_uuid_class")();
2075+
20742076
for (size_t i = 0; i < paramSetSize; ++i) {
20752077
const py::handle& element = columnValues[i];
20762078
std::array<unsigned char, 16> uuid_bytes;
@@ -3903,6 +3905,14 @@ PYBIND11_MODULE(ddbc_bindings, m) {
39033905
});
39043906

39053907

3908+
// Module-level UUID class cache
3909+
// This caches the uuid.UUID class at module initialization time and keeps it alive
3910+
// for the entire module lifetime, avoiding static destructor issues during Python finalization
3911+
m.def("_get_uuid_class", []() -> py::object {
3912+
static py::object uuid_class = py::module_::import("uuid").attr("UUID");
3913+
return uuid_class;
3914+
}, "Internal helper to get cached UUID class");
3915+
39063916
// Add a version attribute
39073917
m.attr("__version__") = "1.0.0";
39083918

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def finalize_options(self):
8383

8484
setup(
8585
name='mssql-python',
86-
version='0.12.0',
86+
version='0.13.0',
8787
description='A Python library for interacting with Microsoft SQL Server',
8888
long_description=open('PyPI_Description.md', encoding='utf-8').read(),
8989
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)