You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Work Item / Issue Reference
<!--
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below (e.g.
AB#37452)
For external contributors: Insert Github Issue number below (e.g. #149)
Only one reference is required - either GitHub issue OR ADO Work Item.
-->
<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#34926](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/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.
---------
Co-authored-by: Jahnvi Thakkar <[email protected]>
0 commit comments