Open SchmoFl opened 1 year ago
@SchmoFl Wouldn't this be as simple as removing the validate
argument in the as_tibble()
call?
I can confirm removing , validate = FALSE
from line 82 of influxdb_json_parser.R
fixes this problem.
I've figured out how to do this locally, but I don't know how to create a pull request. Maybe now is the time for me to learn...?
Only removing , validate = FALSE does not seem to be enough. I installed the PR as follows:
devtools::install_github("dleutnant/influxdbr", ref = github_pull("81"))
When doing a query I get the following error now:
Error in purrr::map()
:
ℹ In index: 1.
Caused by error in purrr::map()
:
ℹ In index: 1.
ℹ With name: results.
Caused by error in purrr::map_int()
:
ℹ In index: 1.
Caused by error:
! Result must be length 1, not 0.
Run rlang::last_trace()
to see where the error occurred.
With the following trace:
│ └─influxdbr::influx_query(...) │ └─... %>% purrr::map_if(result_is_empty, ~NULL) ├─purrr::map_if(., result_is_empty, ~NULL) │ └─purrr:::whereif(.x, .p) │ └─purrr:::map(.x, .p, ..., .type = "logical", .purrr_error_call = .purrr_error_call) │ └─purrr:::vctrs_vec_compat(.x, .purrr_user_env) ├─purrr::flatten(.) └─purrr::map(., query_list_to_tibble, timestamp_format = timestampformat) └─purrr:::map("list", .x, .f, ..., .progress = .progress) ├─purrr:::with_indexed_errors(...) │ └─base::withCallingHandlers(...) ├─purrr:::call_withcleanup(...) └─influxdbr (local) .f(.x[[i]], ...) └─purrr::map(...) └─purrr:::map("list", .x, .f, ..., .progress = .progress) ├─purrr:::with_indexed_errors(...) │ └─base::withCallingHandlers(...) ├─purrr:::call_with_cleanup(...) └─influxdbr (local) .f(.x[[i]], ...) └─purrr::map_int(result$seriesvalues, nrow) └─purrr:::map("integer", .x, .f, ..., .progress = .progress) ├─purrr:::with_indexed_errors(...) │ └─base::withCallingHandlers(...) └─purrr:::call_with_cleanup(...)
I think you still need the tibble::as_tibble(.)
line in there, so it looks like this:
purrr::map( ~ purrr::map_at(., .at = "time",
~ as.POSIXct(. / div,
origin = "1970-1-1",
tz = "GMT")) %>%
tibble::as_tibble(.))
I tried that, same error as above
The same issue here in show_databases
and influx_query
> show_databases(con = con)
Error:
! The `validate` argument of `as_tibble()` was deprecated in tibble 2.0.0 and is now defunct.
ℹ Please use the `.name_repair` argument instead.
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/lifecycle_error_deprecated>
Error:
! The `validate` argument of `as_tibble()` was deprecated in tibble 2.0.0 and is now defunct.
ℹ Please use the `.name_repair` argument instead.
---
Backtrace:
▆
1. ├─influxdbr::show_databases(con = con)
2. │ ├─... %>% purrr::map_df(~ dplyr::select(., name))
3. │ └─influxdbr::influx_query(...)
4. │ └─... %>% purrr::map_if(result_is_empty, ~NULL)
5. ├─purrr::map_df(., ~dplyr::select(., name))
6. │ └─purrr::map(.x, .f, ...)
7. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
8. │ └─purrr:::vctrs_vec_compat(.x, .purrr_user_env)
9. ├─purrr::map_if(., result_is_empty, ~NULL)
10. │ └─purrr:::where_if(.x, .p)
11. │ └─purrr:::map_(.x, .p, ..., .type = "logical", .purrr_error_call = .purrr_error_call)
12. │ └─purrr:::vctrs_vec_compat(.x, .purrr_user_env)
13. ├─purrr::flatten(.)
14. ├─purrr::map(., query_list_to_tibble, timestamp_format = timestamp_format)
15. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
16. │ ├─purrr:::with_indexed_errors(...)
17. │ │ └─base::withCallingHandlers(...)
18. │ ├─purrr:::call_with_cleanup(...)
19. │ └─influxdbr (local) .f(.x[[i]], ...)
20. │ └─purrr::map(...)
21. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
22. │ ├─purrr:::with_indexed_errors(...)
23. │ │ └─base::withCallingHandlers(...)
24. │ ├─purrr:::call_with_cleanup(...)
25. │ └─influxdbr (local) .f(.x[[i]], ...)
26. │ └─... %>% ...
27. ├─purrr::map(...)
28. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
29. │ ├─purrr:::with_indexed_errors(...)
30. │ │ └─base::withCallingHandlers(...)
31. │ ├─purrr:::call_with_cleanup(...)
32. │ └─influxdbr (local) .f(.x[[i]], ...)
33. │ └─... %>% tibble::as_tibble(., validate = FALSE)
34. ├─tibble::as_tibble(., validate = FALSE)
35. └─tibble:::as_tibble.list(., validate = FALSE)
36. └─lifecycle::deprecate_stop(...)
37. └─lifecycle:::deprecate_stop0(msg)
Run rlang::last_trace(drop = FALSE) to see 1 hidden frame.
I think you still need the
tibble::as_tibble(.)
line in there, so it looks like this:purrr::map( ~ purrr::map_at(., .at = "time", ~ as.POSIXct(. / div, origin = "1970-1-1", tz = "GMT")) %>% tibble::as_tibble(.))
This definitely works.
The pull request #81 removes too much code! I have fixed it by cloning the repo, making the correct fix, and installing the package by using devtools::install('path/to/package')
and it works.
@adamjbc I've generated a pull request with your correction. Package is functioning as intended on R4.3.3. Utilize remotes::install_github("dleutnant/influxdbr", ref = remotes::github_pull(82))
The
validate
argument of theas_tibble
function has been deprecated sincetibble
version 2.0.0. Since version 3.2.0 the change is breaking. Thevalidate
argument is still explicitly used in theinfluxdbr::influx_query
function, which therefore is throwing the following error when used withtibble
verison 3.2.0 or higher: Thevalidate
argument ofas_tibble()
was deprecated in tibble 2.0.0 and is now defunct.