Last active
December 11, 2024 08:20
-
-
Save StaffanBetner/2954f277192e109993ce2b73b622d1e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(duckdb) | |
library(DBI) | |
library(dbplyr) | |
duckdb_write_parquet <- function(tbl_obj, filename){ | |
library(tictoc) | |
library(glue) | |
tbl_object$src$con -> con | |
con %>% dbExecute("SET autoinstall_known_extensions=1;") | |
con %>% dbExecute("SET autoload_known_extensions=1;") | |
tic();dbExecute(con, glue("COPY ({sql_render(tbl_obj)}) TO '{filename}' (FORMAT 'parquet', COMPRESSION ZSTD);"));toc() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternative: