-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Allow customization of ParamValueConverterRegistry
#283
Comments
Hi! the I'm definitely open to allow passing converter overrides via constructor and then just array_merge it with default one. I'll look at the timezone thingie later (tomorrow?) |
ParamValueConverterRegistry
?ParamValueConverterRegistry
?
ParamValueConverterRegistry
?ParamValueConverterRegistry
I have implemented the functionality in PR #286, please have a look and feel free to comment.
I don't think there's much to look at. As far as I understand it, the current way of omitting the timezone information from datetimes is the default way Clickhouse expects these values to be inserted. Clickhouse can't handle timezone information in datetime strings unless they are properly ISO 8601 formatted and the I just personally prefer having this information present at all time and not messing around with application side conversion before passing the values to Clickhouse, so I opt in to passing this option every time I insert data or query datetime related values. If I'm not mistaken, this can and should only be a userland decision. |
There's timezone param in ValueFormatter that ensures timezone is not stripped on insertion.
I planned to consolidate ValueFormatter and ParamValueConverterRegistry |
WDYT about #287? |
I have added a comment to that PR: #287 (comment) |
Abstract
The current constructor of the
Psr17Client
requires an instance ofRequestFactory
which then requires an instance ofParamValueConverterRegistry
.As far as I understand,
ParamValueConverterRegistry
is responsible for converting query parameters into a usable format for the HTTP API.RequestFactory
andParamValueConverterRegistry
are both implemented asfinal
, so there is no way to apply any customization in the userland.Use Case
For my current use case, I would like to change the way of transmitting any time-related value to my ClickHouse instance. I am using
DateTimeInterface
compatible objects in my code and pass them as parameters to clickhouse, but this library strips the timezone information:The parameter is being sent as
The readme clearly states that it's my obligation to correctly handle timezones and pass them to the library in a way that the clickhouse instance can process it (and/or use the timezone conversion of the library).
However, I'd prefer to have my datetime objects converted to a unix timestamp instead (or a ISO8601 string with tz/offset information and then have Clickhouse parse that with
date_time_input_format=best_effort
.Possible Solutions
final
fromParamValueConverterRegistry
ParamValueConverterRegistry
, either by passing them to the constructor or by adding asetConverter (string $type, callable $closure)
method (personally preferred)Obviously, there are more possible solutiouns, but these seem to be the least intrusive to me.
Let me know what you think, I'm happy to provide a PR.
The text was updated successfully, but these errors were encountered: