Skip to content

FIX: Use ODBC 3.x parameter types instead of ODBC 2.x - #758

Merged
ttk (Theekshna) merged 3 commits into
mainfrom
tkotian/use-odbc3-temporal-types
Sep 8, 2026
Merged

FIX: Use ODBC 3.x parameter types instead of ODBC 2.x#758
ttk (Theekshna) merged 3 commits into
mainfrom
tkotian/use-odbc3-temporal-types

Conversation

@Theekshna

@Theekshna ttk (Theekshna) commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Work Item / Issue Reference

Closes #757
Closes https://sqlclientdrivers.visualstudio.com/mssql-rs/_workitems/edit/47874/


Summary

Use ODBC 3.x concise temporal SQL types for Python-side parameter inference. Canonicalize legacy temporal hints passed to setinputsizes() before binding while preserving exported constant values. Add focused coverage for inferred and explicit temporal types.

Validation

  • python -m black --check --line-length=100 mssql_python/ tests/
  • Focused mapping tests: 3 passed
  • tests/test_000_dependencies.py: 35 passed, 3 skipped
  • Live SQL tests not run locally because DB_CONNECTION_STRING is unavailable.

@github-actions github-actions Bot added the pr-size: small Minimal code update label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

83%


📈 Total Lines Covered: 7959 out of 9522
📁 Project: mssql-python


Diff Coverage

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

  • mssql_python/cursor.py (100%)

Summary

  • Total: 3 lines
  • Missing: 0 lines
  • Coverage: 100%

📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.logger_bridge.cpp: 57.9%
mssql_python.pybind.ddbc_bindings.h: 61.5%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 77.5%
mssql_python.row.py: 77.6%
mssql_python.pybind.connection.connection_pool.cpp: 81.6%
mssql_python.pybind.connection.connection.cpp: 84.4%
mssql_python.logging.py: 85.5%
mssql_python.helpers.py: 89.3%
mssql_python.pooling.py: 90.1%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

@Theekshna
ttk (Theekshna) marked this pull request as ready for review September 7, 2026 06:18
Copilot AI lite review requested due to automatic review settings September 7, 2026 06:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes directly satisfy the stated acceptance criteria and are backed by focused tests covering both inference and setinputsizes() canonicalization.

Pull request overview

This PR updates the Python-side parameter type inference and setinputsizes() handling to consistently use ODBC 3.x concise temporal SQL type identifiers (DATE/TIME/TIMESTAMP) when binding parameters, aligning the driver’s behavior with its declared ODBC 3.8 application mode and improving compatibility with ODBC 3.x–only drivers (per #757).

Changes:

  • Switch Python-side inference for datetime.date / naive datetime.datetime to SQL_TYPE_DATE / SQL_TYPE_TIMESTAMP.
  • Canonicalize legacy ODBC 2.x temporal hints provided via Cursor.setinputsizes() to their ODBC 3.x equivalents before storage/binding.
  • Add focused unit coverage for the updated inference and canonicalization behavior, and update execute-path parity expectations.
File summaries
File Description
mssql_python/cursor.py Updates temporal inference to ODBC 3.x types and canonicalizes legacy temporal types in setinputsizes().
tests/test_004_cursor.py Adds targeted tests asserting ODBC 3.x temporal inference and setinputsizes() canonicalization.
tests/test_023_execute_path_parity.py Aligns parity test expectations to ODBC 3.x temporal SQL type constants.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

…poral-types

# Conflicts:
#	mssql_python/cursor.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes directly meet the issue’s acceptance criteria and include focused tests verifying both inference and setinputsizes() canonicalization for temporal types.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@Theekshna
ttk (Theekshna) enabled auto-merge (squash) September 8, 2026 03:22
@Theekshna
ttk (Theekshna) merged commit cb0bd6c into main Sep 8, 2026
30 checks passed
@Theekshna
ttk (Theekshna) deleted the tkotian/use-odbc3-temporal-types branch September 8, 2026 04:25
VyrnSynx (vyrnsynx) added a commit to vyrnsynx/mssql-python that referenced this pull request Sep 8, 2026
Resolve conflict in execute(): keep upstream native DDBCSQLExecute /
DDBCSQLExecDirect path from microsoft#736/microsoft#758; retain microsoftGH-745 executemany
SQL_NUMERIC batch precision/scale changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: small Minimal code update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use ODBC 3.x temporal types for parameter binding

4 participants