FEAT: Adding getTypeInfo#193
Merged
jahnvi480 merged 3 commits intojahnvi/cursor_setinputsizesfrom Sep 15, 2025
Merged
Conversation
sumitmsft
approved these changes
Sep 11, 2025
sumitmsft
approved these changes
Sep 12, 2025
bewithgaurav
approved these changes
Sep 15, 2025
### 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#34933](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/34933) ------------------------------------------------------------------- ### Summary This pull request adds support for retrieving metadata about stored procedures in SQL Server via the Python driver, including both temporary and permanent procedures. It introduces a new `procedures()` method on the `cursor` object, updates the C++ pybind layer to expose the ODBC `SQLProcedures` API, and includes a comprehensive suite of tests to ensure correct behavior across various scenarios. **New feature: Procedures metadata retrieval** * Added `procedures()` method to the `cursor` class in `mssql_python/cursor.py` to fetch information about stored procedures, handling both temporary (using direct queries) and permanent procedures (using the ODBC API). The method supports filtering by procedure name, catalog, and schema, and returns detailed metadata for each procedure. **ODBC bindings and pybind integration** * Introduced new function pointer type `SQLProceduresFunc` and related extern variable to the ODBC bindings header and implementation files (`mssql_python/pybind/ddbc_bindings.h`, `mssql_python/pybind/ddbc_bindings.cpp`). * Loaded the `SQLProceduresW` function pointer during driver initialization and included it in the required function check. * Implemented a wrapper function `SQLProcedures_wrap` and exposed it to Python as `DDBCSQLProcedures` for cross-platform use. **Testing and validation** * Added a comprehensive set of tests to `tests/test_004_cursor.py` to verify the new `procedures()` functionality, including filtering by name, schema, and catalog, handling of input/output parameters, result set reporting, and correct behavior with non-existent procedures. --------- Co-authored-by: Jahnvi Thakkar <jathakkar@microsoft.com>
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.
Work Item / Issue Reference
Summary
This pull request adds support for retrieving ODBC data type information via a new
getTypeInfomethod on thecursorobject, exposing the underlyingSQLGetTypeInfoAPI. It includes the necessary C++/Python bindings, error handling, and comprehensive test coverage to ensure correct behavior for different data types and usage scenarios.Feature: Data type information retrieval
getTypeInfomethod to thecursorclass inmssql_python/cursor.py, allowing users to retrieve metadata about supported SQL data types via the ODBCSQLGetTypeInfoAPI. The method supports querying all types or a specific type and returns results as a list ofRowobjects with a well-defined column map.Bindings and driver integration
SQLGetTypeInfo(SQLGetTypeInfoFunc) and integrated it into the driver loading and verification process inmssql_python/pybind/ddbc_bindings.handmssql_python/pybind/ddbc_bindings.cpp. This ensures the function pointer is loaded and checked along with other ODBC APIs.SQLGetTypeInfo, exposing it asDDBCSQLGetTypeInfoin the Python module.Testing
tests/test_004_cursor.pyto validate the newgetTypeInfomethod. Tests cover retrieving all types, specific types, result structure, numeric and datetime types, binary types, multiple successive calls, and repeated identical queries for consistency and efficiency.