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

The validate argument of as_tibble() is deprecated. #80

Open
SchmoFl opened this issue Mar 28, 2023 · 7 comments
Open

The validate argument of as_tibble() is deprecated. #80

SchmoFl opened this issue Mar 28, 2023 · 7 comments

Comments

@SchmoFl
Copy link

SchmoFl commented Mar 28, 2023

The validate argument of the as_tibble function has been deprecated since tibble version 2.0.0. Since version 3.2.0 the change is breaking. The validate argument is still explicitly used in the influxdbr::influx_query function, which therefore is throwing the following error when used with tibble verison 3.2.0 or higher:
The validate argument of as_tibble() was deprecated in tibble 2.0.0 and is now defunct.

@ComeMaes
Copy link

ComeMaes commented Apr 7, 2023

@SchmoFl Wouldn't this be as simple as removing the validate argument in the as_tibble() call?

@adamjbc
Copy link

adamjbc commented Apr 30, 2023

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...?

@oldirtybasti
Copy link

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:::where_if(.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 = timestamp_format)
└─purrr:::map_("list", .x, .f, ..., .progress = .progress)
├─purrr:::with_indexed_errors(...)
│ └─base::withCallingHandlers(...)
├─purrr:::call_with_cleanup(...)
└─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$series_values, nrow)
└─purrr:::map_("integer", .x, .f, ..., .progress = .progress)
├─purrr:::with_indexed_errors(...)
│ └─base::withCallingHandlers(...)
└─purrr:::call_with_cleanup(...)

@adamjbc
Copy link

adamjbc commented Jun 11, 2023

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(.))

@oldirtybasti
Copy link

I tried that, same error as above

@Patrikios
Copy link

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.

@adamjbc
Copy link

adamjbc commented May 9, 2024

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.

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

No branches or pull requests

5 participants