Skip to content

fix: support JDBC driver setTimestamp - #375

Merged
tekumara merged 4 commits into
tekumara:mainfrom
anjeongkyun:fix/374-timestamp-bindings
Aug 11, 2026
Merged

fix: support JDBC driver setTimestamp#375
tekumara merged 4 commits into
tekumara:mainfrom
anjeongkyun:fix/374-timestamp-bindings

Conversation

@anjeongkyun

Copy link
Copy Markdown
Contributor

setTimestamp() failed with a 500 for every timestamp column, because from_binding only converted TIMESTAMP_NTZ. The JDBC driver sends setTimestamp as TIMESTAMP_LTZ, so the epoch-nanoseconds string fell through to the else branch and reached duckdb unconverted:

_duckdb.ConversionException: Conversion Error: timestamp field value out of range: "1767229200000000000"

TIMESTAMP_TZ needed handling separately — the connector encodes it as <epoch nanoseconds> <utc offset in minutes + 1440>, so int() on the whole value fails.

Verified with snowflake-jdbc 3.19.0 against the server:

                 before   after
TIMESTAMP_NTZ    500      2026-01-01 01:00:00 Z
TIMESTAMP_LTZ    500      2026-01-01 01:00:00 Z
TIMESTAMP_TZ     500      2026-01-01 01:00:00 Z
TIMESTAMP        500      2026-01-01 01:00:00 Z

That's the same instant a real account returns for the same binding — 2025-12-31 17:00:00.000 -0800 on a session in America/Los_Angeles — only the rendering timezone differs.

setDate and setTime were already fine, and setTime matches real Snowflake including the timezone shift.

Fixes #374

anjeongkyun and others added 2 commits August 11, 2026 02:38
from_binding only converted TIMESTAMP_NTZ, so setTimestamp() failed with a 500
for every timestamp column — the JDBC driver sends it as TIMESTAMP_LTZ and the
epoch-nanoseconds string reached duckdb unconverted.

TIMESTAMP_TZ needs separate handling because the connector encodes it as
'<epoch nanoseconds> <utc offset in minutes + 1440>'.

Fixes tekumara#374
@tekumara tekumara changed the title fix: convert TIMESTAMP_LTZ and TIMESTAMP_TZ bindings fix: support JDBC driver setTimestamp Aug 11, 2026
Comment thread tests/test_server.py
cur.execute("select * from example where xint = ?", (1,))


def test_server_binding_timestamp_ltz(server: dict) -> None:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@anjeongkyun FYI i've added a integration test to cover this

@tekumara
tekumara enabled auto-merge (squash) August 11, 2026 12:37
@tekumara
tekumara merged commit 4f95d7b into tekumara:main Aug 11, 2026
1 check passed
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.

setTimestamp() fails with 500 for all timestamp columns: from_binding only converts TIMESTAMP_NTZ

2 participants