Skip to content

Fix: preserve microsecond precision in datetime parameter binding (legacy #70)#89

Open
HenryNebula wants to merge 4 commits intodevfrom
triage/88-datetime-param-binding
Open

Fix: preserve microsecond precision in datetime parameter binding (legacy #70)#89
HenryNebula wants to merge 4 commits intodevfrom
triage/88-datetime-param-binding

Conversation

@HenryNebula
Copy link
Copy Markdown
Owner

Summary

Fixes #88: Python datetime/date/time parameter binding had precision and compatibility issues in the fallback JDBC path.

Changes

  • _to_java() for datetime.datetime: Include fractional seconds (%S.%f) so java.sql.Timestamp preserves microsecond precision instead of truncating to whole seconds
  • _to_java() for datetime.time: Use explicit %H:%M:%S format instead of isoformat(), since java.sql.Time.valueOf() rejects fractional seconds and would crash on time objects with microseconds
  • Added mock tests: datetime with microseconds precision, mixed parameter types, time with microseconds
  • Added HSQLDB integration test: full datetime/date/time parameter round-trip

Test plan

  • Added mock tests for datetime microsecond preservation and time with microseconds
  • Added integration test for datetime/date/time parameter round-trip
  • All 63 mock tests pass
  • All 17 HSQLDB integration tests pass

Closes #88

Generated with Claude Code

HenryNebula and others added 4 commits April 28, 2026 09:02
…gacy #70)

The fallback path's _to_java() was dropping microseconds when converting
Python datetime to java.sql.Timestamp (%S instead of %S.%f), and
time.isoformat() could produce fractional seconds that java.sql.Time
rejects. Also adds regression tests for datetime/date/time parameter
binding in both mock and integration test suites.

Closes #88

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Trino truncates to millisecond precision, Oracle returns datetime for
DATE columns. Relax assertions to compare at second-level precision
and accept both date/datetime forms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Oracle's JDBC driver returns TIME columns as datetime(1970,1,1,HH,MM,SS)
instead of a pure time object. Relax the time assertion to check
hour/minute/second components regardless of the wrapping type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@HenryNebula HenryNebula force-pushed the triage/88-datetime-param-binding branch from 432d3dc to 9ed78b1 Compare April 28, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant