-
Notifications
You must be signed in to change notification settings - Fork 28
FIX: Revert "FEAT: Support for Native_UUID Attribute (#282)" #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request removes the native_uuid global setting feature from the mssql_python package, simplifying UUID handling to always return UUID objects from the database. The PR also cleans up related code in the Row class and removes tests that validated the now-removed feature.
Key changes:
- Removed
native_uuidsetting and all related validation/toggle logic - Simplified Row class by removing UUID conversion and settings snapshot logic
- Removed tests for
native_uuidsetting behavior and validation - Cleaned up duplicate code in cursor.py's execute method
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| mssql_python/init.py | Removed native_uuid property, validation, and module-level exports; simplified Settings class to only include lowercase and decimal_separator |
| mssql_python/row.py | Removed UUID processing logic, settings snapshots, and related imports; simplified __init__ and removed _process_uuid_values method |
| mssql_python/cursor.py | Removed UUID indices tracking and settings snapshots from execute method; simplified Row object creation |
| tests/test_001_globals.py | Removed native_uuid import and all tests validating native_uuid behavior and type validation |
| tests/test_004_cursor.py | Removed native_uuid toggle logic from UUID-related tests and removed comprehensive tests for native_uuid setting behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This reverts commit 10a8815.
1d43c74 to
749a958
Compare
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changes
Summary
mssql_python/cursor.pyLines 1143-1153 1143 column_metadata = []
1144 try:
1145 ddbc_bindings.DDBCSQLDescribeCol(self.hstmt, column_metadata)
1146 self._initialize_description(column_metadata)
! 1147 except Exception as e:
1148 # If describe fails, it's likely there are no results (e.g., for INSERT)
! 1149 self.description = None
1150
1151 self._reset_inputsizes() # Reset input sizes after execution
1152 # Return self for method chaining
1153 return selfmssql_python/row.pyLines 101-109 101 converted_values[i] = converter(value)
102 except Exception:
103 # Log the exception for debugging without leaking sensitive data
104 if hasattr(self._cursor, 'log'):
! 105 self._cursor.log('debug', 'Exception occurred in output converter', exc_info=True)
106 # If conversion fails, keep the original value
107 pass
108
109 return converted_valuesLines 129-139 129
130 # If lowercase is enabled on the cursor, try case-insensitive lookup
131 if hasattr(self._cursor, 'lowercase') and self._cursor.lowercase:
132 name_lower = name.lower()
! 133 for col_name in self._column_map:
! 134 if col_name.lower() == name_lower:
! 135 return self._values[self._column_map[col_name]]
136
137 raise AttributeError(f"Row has no attribute '{name}'")
138
139 def __eq__(self, other: Any) -> bool:📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.ddbc_bindings.cpp: 70.7%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection.cpp: 81.2%
mssql_python.connection.py: 82.9%
mssql_python.cursor.py: 83.4%
mssql_python.pybind.connection.connection_pool.cpp: 84.8%
mssql_python.auth.py: 87.1%
mssql_python.pooling.py: 87.7%
mssql_python.helpers.py: 88.9%
mssql_python.row.py: 90.9%🔗 Quick Links
|
This reverts commit 10a8815.
Work Item / Issue Reference
Summary
This pull request refactors the global settings management and row handling logic for the
mssql_pythonpackage. The main improvements include simplifying how global settings likelowercaseand decimal separator are managed, removing the custom module class, and streamlining theRowobject to reduce memory usage and complexity. The changes also clarify the output converter logic and remove redundant code related to settings snapshots and UUID handling.Settings and Global Configuration Improvements:
Settingsobject, protected by a threading lock, and a custom module-level__setattr__for direct attribute updates [1] [2] [3].setDecimalSeparatorandgetDecimalSeparatorfor explicit decimal separator control, with input validation and C++ backend integration.Row Object and Data Handling Simplification:
Rowclass to remove the settings snapshot and native UUID conversion logic, reducing per-row memory usage and complexity; column mapping is now optimized for future improvements [1] [2].fetchone,fetchmany,fetchall) to no longer pass or rely on settings snapshots, simplifying their signatures and usage [1] [2] [3].Output Converter Logic Cleanup:
Rowclass, removing unnecessary integer byte size mapping and improving error handling and logging for converter exceptions [1] [2].Cursor Execution and Description Handling:
(References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]