-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
remove argument "return_xts" in influx_query? Add tsibble? #49
Comments
What you propose makes sense to me. I would add to this that internally there is no need to use json parser. Just request a csv and parse with Regarding the breaking change, I think it's best to just increment the major version of the package and announce that it's a breaking change. I am sure all users would appreciate this as the current return value is far from elegant. |
Cool! That’d be great! Thank you! |
The proposed change most likely would also address #48. |
I have looked at it and there is a hiccup with older version of influxdb (1.1.1, current stable is 1.7.6). When the accepted output is application/csv and there is a query error which generates 400 status the content of the error is empty. So the user won't get an informative output. For example both of the following would produce an empty output: curl -v -H "Accept: application/csv" --data-urlencode "q=some-query" -G "http://localhost:8086/query"
curl -v -H "Accept: application/csv" --data-urlencode "qq=some-query" -G "http://localhost:8086/query" I don't know which version of influx fixed this issue, but 1.1.1 is still the default on ubuntu 18.04, which is relatively recent OS. So I believe this is a show stopper for the csv parser. The good news is that most of the time is spent by influx on building the response, so parsing csv instead of json on the R side has small speed benefits relatively speaking. |
OK, let's stick to the json parser. (anyway: nice idea to reduce package dependencies!) |
A heads up. I am very close to finishing this and reducing dependencies to 0 on both write and read. Will be back with a PR hopefully later today. |
Wow! looking forward to it! |
Actually there is a small hick up with multiple queries. Do you really want to merge multiple queries into one big data.frame? I think it would make sense to return a list of data.frames, one data.frame per query and let the user decide what to do with it. I am currently using a custom rbind_list which would fall back on data.table::rbindlist, dplyr::rbind_list and then base::rbind, whichever is available on the user's system without an explicit dependency. Both data.table:rbindlist and dplyr::rbind can handle heterogenuous components but not base::rbind. If you really want binding for multiple quieries then one posibility would be to fail with message to install data.table or dplyr in case the user uses multiple quieries in one request (which I think is pretty rare). What do you think? |
Agreed, as each single result might contain a different set of tags. |
... and fields, of course. |
Currently, the
influx_query
result is either adata.frame
(tibble
) or anxts
object. The latter is only the case, if the function call specifically contains thereturn_xts=TRUE
argument. However, this approach is strictly limited to thexts
time series class. With the recent development of the tsibble package, a powerful time series class is available which could be useful to incorporate intoinfluxdbr
. Therefore, one idea isdata.frame
(tibble
),data.frame
andas_xts.influxdb_result
,as_tsibble.influxdb_result
.This would allow the following chain:
This change would potentially break existing codes. What is the best-practice of deprecate function arguments?
The text was updated successfully, but these errors were encountered: