github microsoft/mssql-python v0.14.0-preview

pre-release9 hours ago

Release Notes - Version 0.14.0

Features

  • Major Fetch Performance Optimizations (#320, #304)

    What changed: Implemented direct UTF-16 decoding for NVARCHAR on Linux/macOS, direct Python C API usage for numeric types, batch row allocation, function pointer dispatch table (major reduction in type dispatch overhead), and cached output converters/column maps
    Who benefits: All applications fetching result sets, analytics workloads processing large datasets, and performance-sensitive applications
    Impact: Faster for large result sets (100K+ rows), Significant improvement for very large result sets (~1.2M rows).

  • Connection String Parser and Validation (#307)

    What changed: Implemented comprehensive ODBC connection string parser per MS-ODBCSTR specification with parameter allowlist validation, synonym normalization (e.g., hostServer, userUID), and clear error messages for malformed strings
    Who benefits: All users connecting to SQL Server, developers troubleshooting connection string issues, and applications migrating from other database systems
    Impact: Catches connection string errors early with actionable messages and prevents silent failures.
    Breaking change: Unknown parameters now raise ConnectionStringParseError instead of being silently ignored

    Fixes #306

  • Enhanced DECIMAL Precision (#287)

    What changed: Increased precision support from 15 to 38 digits (SQL Server maximum) with proper binary representation for high-precision decimals via SQL_NUMERIC_STRUCT
    Who benefits: Financial applications requiring maximum precision, scientific/engineering applications with high-precision calculations, and data migration scenarios
    Impact: Eliminates precision loss for large decimal values and ensures full compliance with SQL Server's DECIMAL(38, scale) capabilities

  • Comprehensive Logging Framework (#312)

    What changed: Unified Python-C++ logging bridge with performance-optimized implementation, new setup_logging() API for DEBUG-level diagnostic logging, ~150 strategic LOG statements across C++ layer, and zero overhead when disabled via atomic level checks
    Who benefits: Developers troubleshooting connection or query issues, support teams diagnosing production problems, and contributors debugging driver behavior
    Impact: Enables detailed diagnostic logging for issue investigation with minimal performance impact when disabled (default state)

  • Connection Attribute Control (set_attr) (#177)

    What changed: Added Connection.set_attr() method for configuring ODBC connection attributes including transaction isolation levels, timeouts, access modes, and other connection options with pyodbc-compatible API
    Who benefits: Applications requiring fine-grained connection control, developers migrating from pyodbc, and systems needing custom isolation levels or timeout configurations
    Impact: Provides full control over connection behavior and enables advanced scenarios while improving pyodbc compatibility

  • XML Data Type Support (#293)

    What changed: Added comprehensive support for SQL Server XML data type with proper handling for insertion, retrieval, batching, and streaming of XML data
    Who benefits: Applications processing structured or semi-structured XML data, systems integrating with XML-based APIs, and developers using SQL Server's native XML features
    Impact: Enables native XML storage and retrieval with efficient streaming for large documents, supporting all CRUD operations

  • DECIMAL Scientific Notation Support (#313)

    What changed: Improved handling of decimal values in scientific notation when converting to SQL VARCHAR types, using fixed-point formatting to prevent SQL Server conversion errors
    Who benefits: Applications working with very large or very small decimal values that may be represented in scientific notation
    Impact: Prevents conversion errors and ensures consistent decimal formatting across all value ranges

Bug Fixes

  • Access Token Buffer Management (#323)

    What changed: Refactored access token handling from static vectors to instance-level buffers in Connection class, improving memory safety and encapsulation for Microsoft Entra ID authentication
    Who benefits: Applications using Microsoft Entra ID (Azure AD) authentication, multi-threaded applications with concurrent connections, and users experiencing intermittent authentication failures
    Impact: Fixes authentication token corruption in concurrent scenarios and enhances thread safety for connection attributes

  • Decimal Type Inference for executemany (#322)

    What changed: Improved _compute_column_type logic to better handle Decimal values with proper sample value selection for type inference, preferring longer/higher-precision values
    Who benefits: Applications using batch inserts with Decimal values, financial systems using executemany for performance, and developers encountering type inference errors
    Impact: Eliminates exceptions during batch Decimal inserts and improves reliability for executemany operations

    Fixes #272

This release delivers significant performance improvements, new data type support, enhanced security, and a robust logging framework while maintaining backward compatibility (except for connection string validation). Much faster fetch performance gains and expanded SQL Server compatibility make this a compelling upgrade for production deployments.

Breaking Changes

⚠️ Connection String Validation (#307): Unknown or misspelled connection parameters now raise ConnectionStringParseError instead of being silently ignored. Reserved parameters (Driver, APP) cannot be set by users. Review connection strings for typos or unknown parameters before upgrading.

Migration Notes

  • Connection string errors will now be caught early with clear error messages
  • Remove any attempts to set Driver or APP parameters (managed by the driver)
  • Example: ConnectionStringParseError: Unknown keyword 'Servr' → Fix typo to Server

Don't miss a new mssql-python release

NewReleases is sending notifications on new releases.