Skip to content

Conversation

jahnvi480
Copy link
Contributor

@jahnvi480 jahnvi480 commented Aug 22, 2025

Work Item / Issue Reference

AB#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.

@github-actions github-actions bot added the pr-size: medium Moderate update size label Aug 22, 2025
@github-actions github-actions bot added pr-size: medium Moderate update size and removed pr-size: medium Moderate update size labels Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-size: medium Moderate update size
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant