Skip to content

Conversation

jahnvi480
Copy link
Contributor

@jahnvi480 jahnvi480 commented Aug 18, 2025

Work Item / Issue Reference

AB#34926


Summary

This pull request adds a new tables() method to the Cursor class in mssql_python/cursor.py, providing a way to query metadata about tables in the database, including support for filtering by name, schema, catalog, and table type. It also introduces comprehensive test coverage for this new method in tests/test_004_cursor.py. Additionally, the skip() method in the cursor is simplified by delegating to the existing scroll() method.

New feature: Table metadata querying

  • Added a tables() method to the Cursor class, enabling users to retrieve information about tables with support for filtering by table name (including temporary tables), schema, catalog, and table type (supports both string and list input). The method returns the cursor itself for easy chaining and iteration.

Testing improvements

  • Introduced a suite of tests for the new tables() method, covering basic usage, filtering by name, schema, and type, wildcard support, combined filters, empty results, iteration, method chaining, and existence checks. These tests ensure the method works as intended and handles edge cases.

Code simplification

  • Refactored the skip() method in the cursor to delegate to the scroll() method in 'relative' mode, removing redundant validation and manual row skipping logic.

@github-actions github-actions bot added the pr-size: medium Moderate update size label Aug 18, 2025
@github-actions github-actions bot added pr-size: large Substantial code update and removed pr-size: medium Moderate update size labels Aug 18, 2025
@github-actions github-actions bot added pr-size: large Substantial code update and removed pr-size: large Substantial code update labels Aug 22, 2025
Copy link
Contributor

@sumitmsft sumitmsft left a comment

Choose a reason for hiding this comment

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

Left a few minor comments.

@github-actions github-actions bot added pr-size: large Substantial code update and removed pr-size: large Substantial code update labels Aug 25, 2025
@jahnvi480 jahnvi480 requested a review from sumitmsft August 25, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-size: large Substantial code update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants