-
Notifications
You must be signed in to change notification settings - Fork 27
FEAT: Adding lowercase for global variable #187
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 introduces a global lowercase flag to the mssql_python package, allowing users to control whether column names in query results are automatically converted to lowercase. The feature includes updates to the global settings infrastructure, cursor and row classes to support the lowercase functionality, and comprehensive tests.
- Added global
lowercaseflag with supporting Settings class and accessor functions - Modified Cursor and Row classes to respect the lowercase setting for column name handling
- Updated Row class to support case-insensitive attribute access when lowercase mode is enabled
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| mssql_python/init.py | Introduces Settings class, global lowercase flag, and get_settings() accessor |
| mssql_python/cursor.py | Updates cursor to read global lowercase setting and apply it to column descriptions |
| mssql_python/row.py | Modifies Row class to support case-insensitive attribute access and updated constructor |
| tests/test_001_globals.py | Adds test to verify default value of lowercase flag |
| tests/test_004_cursor.py | Adds comprehensive test for lowercase functionality with proper cleanup |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
sumitmsft
left a comment
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.
Added a comment.. Please resolve. Rest all looks good
Documentation Enhancement Needed: The new lowercase global variable should be documented in the package documentation to help users understand its behavior and impact. Recommendation: Add documentation for the lowercase global to the main package README. This should include: Purpose: Explain that lowercase controls column name case sensitivity in Row attribute access Default behavior: lowercase=False (case-sensitive, preserves original column names) When enabled: lowercase=True enables case-insensitive attribute access by converting all column names to lowercase Performance note: When enabled, adds slight overhead during cursor description initialization for column name processing Usage Example: ` Enable case-insensitive column access Now all these work regardless of actual column casing: Add a new "Configuration Options" section to the main package README, or include it in an existing "Usage" section if one exists. This documentation will help users understand when and why they might want to enable this feature, especially those migrating from other database libraries that have different case sensitivity behaviors. |
Work Item / Issue Reference
Summary
This pull request introduces a new global
lowercaseflag to themssql_pythonpackage, allowing users to control whether column names in query results are automatically converted to lowercase. The changes include updates to the global settings infrastructure, theCursorandRowclasses to support case-insensitive access, and comprehensive tests to ensure correct behavior.Global lowercase flag and settings:
lowercaseflag and supporting infrastructure tomssql_python/__init__.py, including aSettingsclass and aget_settings()accessor. The default value isFalse.lowercaseflag for external use and updated tests to check its default value.Cursor and Row class enhancements:
Cursorclass to read the globallowercasesetting and pass it toRowobjects. The_initialize_descriptionmethod now lowercases column names in the description if the flag is set.Rowclass to support attribute access by column name, respecting thelowercaseflag for case-insensitive lookup.Cursorinstance toRowobjects for correct lowercase handling.Testing improvements:
lowercaseflag intests/test_004_cursor.py, verifying that column names in the cursor description and row attribute access are correctly lowercased when the flag is enabled.