Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the Row class’s string output by introducing a user-facing __str__ method and refining the __repr__ for clearer debugging.
- Added
__str__to return a stringified tuple of row values - Updated
__repr__to use the built-inreprof the tuple for debugging
Comments suppressed due to low confidence (2)
mssql_python/row.py:69
- [nitpick] The
__repr__output now omits the class name and only shows a bare tuple, which can be ambiguous during debugging. Consider including theRowclass name in the output (e.g.,f"Row({repr(tuple(self._values))})") to make the object type explicit.
return repr(tuple(self._values))
mssql_python/row.py:63
- There are no existing tests covering the new
__str__method (and the updated__repr__). Adding unit tests to verify their outputs will help prevent regressions and ensure correct formatting.
def __str__(self):
bewithgaurav
requested changes
Jul 14, 2025
Collaborator
bewithgaurav
left a comment
There was a problem hiding this comment.
lets add a testcase in test_cursor py file
bewithgaurav
approved these changes
Jul 15, 2025
sumitmsft
approved these changes
Jul 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADO Work Item Reference
Summary
This pull request modifies the
Rowclass inmssql_python/row.pyto improve its string representation methods. The changes include adding a__str__method for user-friendly output and updating the__repr__method to focus on debugging.Enhancements to string representation:
__str__method to provide a user-friendly string representation of theRowobject by returning the tuple of its values as a string.__repr__method to provide a more detailed representation for debugging purposes by using thereprfunction on the tuple of values instead of a formatted string.