FEAT: add native_uuid support by jahnvi480 · Pull Request #463 · microsoft/mssql-python

@jahnvi480

- Add module-level native_uuid property (default=False, matching pyodbc)
- Add per-connection native_uuid override via connect(native_uuid=True/False)
- Connection-level setting takes precedence over module-level
- Snapshot native_uuid at execute() time for consistency within result sets
- Return uppercase UUID strings when native_uuid=False (pyodbc compat)
- Extract _compute_uuid_str_indices() helper to eliminate code duplication
- Move uuid import to module-level in row.py (avoid per-row lazy import)
- Fix Row.__init__ signature in .pyi stub to match implementation
- Remove duplicate DDBCSQLDescribeCol call in execute()
- Add comprehensive tests for both module-level and per-connection control
- Thread-safe settings via _settings_lock

AI review requested due to automatic review settings

March 2, 2026 10:24

@jahnvi480

@jahnvi480

@jahnvi480

@jahnvi480

@jahnvi480

…R columns

- Change Settings.native_uuid default from False to True
- Update docstrings/comments across helpers.py, __init__.py, row.py,
  connection.py, and db_connection.py to reflect new default
- Update test_001_globals.py: test_native_uuid_default expects True
- Update test_004_cursor.py: add test_native_uuid_default_returns_uuid_objects,
  remove defensive str-to-UUID conversions in tests that rely on default
- Users migrating from pyodbc can set native_uuid=False for string UUIDs

@jahnvi480

sumitmsft

bewithgaurav

@jahnvi480