Skip to content
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

Client side binding is not being escaped into server timezone #268

Closed
aursalex opened this issue Nov 9, 2023 · 1 comment · Fixed by #269
Closed

Client side binding is not being escaped into server timezone #268

aursalex opened this issue Nov 9, 2023 · 1 comment · Fixed by #269
Labels
bug Something isn't working

Comments

@aursalex
Copy link

aursalex commented Nov 9, 2023

Something that I reckon when migrating from clickhouse-driver to clickhouse-connect that the datetime implementation is changed and hence the same query and paramenters yield different results.

The difference is because clickhouse-driver replaces timezone instead of converting. Is this intended and can I have a list of breaking changes so that I didn't miss anything changes while migrating?

value = value.replace(tzinfo=server_tz)

https://github.com/mymarilyn/clickhouse-driver/blob/db3dca27bd09a1966981f4c0b43835c117ebd1e1/clickhouse_driver/util/escape.py#L27C14-L27C14

@aursalex aursalex added the enhancement New feature or request label Nov 9, 2023
@genzgd genzgd added bug Something isn't working and removed enhancement New feature or request labels Nov 9, 2023
@genzgd
Copy link
Collaborator

genzgd commented Nov 9, 2023

Thanks for the report!

Defining the "correct" behavior with timezones is always tricky, but I think this is just a bug. I'll release a fix. (Of course, my recommendation is always to keep all datetime values and servers in UTC, and only convert to a local timezone when displaying to the user in a UI).

No other inconsistencies with clickhouse-driver have been reported, but that's a separate project and not maintained by ClickHouse Inc., so we have never validated that both drivers behave exactly the same. That said, in general I think most things are handled the same, although it would not surprise me if there were some differences in Numpy/Pandas datatypes since those are quite convoluted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants