Skip to content

FEAT: Add table-valued parameter support - #789

Merged
Gaurav Sharma (bewithgaurav) merged 28 commits into
mainfrom
bewithgaurav/ab48177-tvp-support
Nov 23, 2026
Merged

Gaurav Sharma (bewithgaurav) merged 28 commits into
mainfrom
bewithgaurav/ab48177-tvp-support

Conversation

@bewithgaurav

@bewithgaurav Gaurav Sharma (bewithgaurav) commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Work Item / Issue Reference

ADO Work Item: Fixed AB#48177


Summary

Adds the shared TableValuedParameter(type_name, columns, rows, *, schema=None) definition and synchronous ODBC execution support.

  • Explicit table identity and ordered column definitions. Lists, tuples and synchronous iterators are accepted; ordinary nested sequences are not inferred as TVPs.
  • Streams one row at a time through ODBC data-at-execution within one SQL execution. Reuses scalar conversions, preserves generator exceptions and retains bound storage until native cleanup is safe.
  • Includes synchronous documentation and coverage for empty input, nullable and typed cells, multiple TVPs, named parameters, cursor reuse, cancellation and recovery. The large memory case is marked stress and excluded from normal PR CI.

Async TVP integration, TVP executemany(), TVP setinputsizes() overrides and the mssql-odbc provider are outside this PR.

Copilot AI added 2 commits September 15, 2026 16:37
Accept materialized nested row sequences for stored-procedure TVP parameters. Resolve the declared table type and child schema from prepared ODBC metadata so empty and typed-NULL rows bind correctly without a public wrapper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the stale GitHub issue reference with the ADO task that tracks this feature.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 15, 2026 11:40
@github-actions github-actions Bot added the pr-size: large Substantial code update label Sep 15, 2026
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

88%


🎯 Overall Coverage

86%


📈 Total Lines Covered: 12101 out of 14046
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

  • mssql_python/init.py (100%)
  • mssql_python/cursor.py (91.7%): Missing lines 1959,1981
  • mssql_python/pybind/connection/connection.cpp (50.0%): Missing lines 178-179
  • mssql_python/pybind/ddbc_bindings.cpp (87.7%): Missing lines 550-551,968-969,1004-1005,1633-1636,1738-1739,1800,2330-2331,2334,2390,2455,2472
  • mssql_python/pybind/ddbc_bindings.h (80.0%): Missing lines 301
  • mssql_python/pybind/param_detect.hpp (100%)
  • mssql_python/pybind/tvp.hpp (89.4%): Missing lines 79,82,90-95,104,143-145,166-168
  • mssql_python/table_valued_parameter.py (89.5%): Missing lines 44,52,58,64,67,69,81,83,89,91,98

Summary