Skip to content

FIX: Adding row string #136

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

Merged
merged 3 commits into from
Jul 16, 2025
Merged

FIX: Adding row string #136

merged 3 commits into from
Jul 16, 2025

Conversation

jahnvi480
Copy link
Contributor

@jahnvi480 jahnvi480 commented Jul 14, 2025

ADO Work Item Reference

AB#37929


Summary

This pull request modifies the Row class in mssql_python/row.py to 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:

  • Added a __str__ method to provide a user-friendly string representation of the Row object by returning the tuple of its values as a string.
  • Updated the __repr__ method to provide a more detailed representation for debugging purposes by using the repr function on the tuple of values instead of a formatted string.

@Copilot Copilot AI review requested due to automatic review settings July 14, 2025 08:24
@github-actions github-actions bot added the pr-size: small Minimal code update label Jul 14, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 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-in repr of 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 the Row class 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):

@github-actions github-actions bot added pr-size: small Minimal code update and removed pr-size: small Minimal code update labels Jul 14, 2025
Copy link
Collaborator

@bewithgaurav bewithgaurav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets add a testcase in test_cursor py file

@github-actions github-actions bot added pr-size: small Minimal code update and removed pr-size: small Minimal code update labels Jul 14, 2025
@github-actions github-actions bot added pr-size: small Minimal code update and removed pr-size: small Minimal code update labels Jul 16, 2025
@jahnvi480 jahnvi480 merged commit 6e11847 into main Jul 16, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-size: small Minimal code update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants