Skip to content

Commit 55a4b6a

Browse files
authored
Merge branch 'main' into bewithgaurav/update_pr_template
2 parents 96d1637 + 49a04c3 commit 55a4b6a

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)