No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

28 líneas
792B

  1. prep_open_dataset <- function(path_prep, partitioning = "sboe_id", ...) {
  2. if (!fs::file_exists(path_prep)) {
  3. path_here <- here::here("data-prep/", path_prep)
  4. path_up <- fs::path("..", "data-prep", path_prep)
  5. if (fs::file_exists(path_here)) {
  6. path_prep <- path_here
  7. } else if (fs::file_exists(path_up)) {
  8. path_prep <- path_up
  9. } else {
  10. stop("File not found: ", path_prep)
  11. }
  12. }
  13. if (length(fs::dir_ls(path_prep, type = "dir")) == 0) {
  14. partitioning <- NULL
  15. }
  16. arrow::open_dataset(path_prep, partitioning = partitioning, ...)
  17. }
  18. prep_open_dataset_db <- function(table, ..., path_prep = table) {
  19. pq <- prep_open_dataset(path_prep, ...)
  20. con <- duckdb_global_con()
  21. duckdb::duckdb_register_arrow(con, table, pq)
  22. dplyr::tbl(con, table)
  23. }