Skip to content

Support DATE and TIME bind parameter types #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

staticlibs
Copy link
Collaborator

Support for DATE and TIME value was lacking in SQLBindParameter/SQLExecute. This change adds such support the same way as TIMESTAMP parameters are handled.

Besides that, when fetching records with SQLGetData there was no conversion from DB TIME type to ODBC TIMESTAMP type. Such conversion for some reason does not exist in the engine. But PyODBC uses it by always fetching TIME columns as TIMESTAMP. This conversion is added manually.

Testing: existing test adjusted when fetching TIME as TIMESTAMP, new test is added to cover SQLBindParameter with TIMESTAMP, DATE and TIME types.

Fixes: #91

@staticlibs staticlibs force-pushed the date_and_time_bind_params branch 2 times, most recently from 6e03103 to 9fb4a93 Compare April 12, 2025 16:35
Support for `DATE` and `TIME` value was lacking in
`SQLBindParameter`/`SQLExecute`. This change adds such support the
same way as `TIMESTAMP` parameters are handled.

Besides that, when fetching records with `SQLGetData` there was no
conversion from DB `TIME` type to ODBC `TIMESTAMP` type. Such
conversion for some reason does not exist in the engine. But PyODBC uses
it by always fetching `TIME` columns as `TIMESTAMP`. This conversion is
added manually.

Testing: existing test adjusted when fetching `TIME` as `TIMESTAMP`, new
test is added to cover `SQLBindParameter` with `TIMESTAMP`, `DATE` and
`TIME` types.

Fixes: duckdb#91
@staticlibs staticlibs force-pushed the date_and_time_bind_params branch from 9fb4a93 to 582b304 Compare April 13, 2025 18:50
@YahiaMost
Copy link

Is there any update or timeline to merge this PR and fix this issue? It is quite critical for our prod workflows and we would greatly appreciate it being addressed

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.

Cannot parameterize queries with date or time values
2 participants