Skip to content

Instantly share code, notes, and snippets.

@fangzhou-xie
Created May 29, 2023 18:51
Show Gist options
  • Save fangzhou-xie/99bccdae0171cd6af796242e63e5ee98 to your computer and use it in GitHub Desktop.
Save fangzhou-xie/99bccdae0171cd6af796242e63e5ee98 to your computer and use it in GitHub Desktop.
# duckdb import tsv snippet
duckdb_fp
tsv_fp
con <- DBI::dbConnect(duckdb::duckdb(), duckdb_fp)
# config duckdb
DBI::dbExecute(con, "SET memory_limit='20GB';")
DBI::dbExecute(con, "SET threads TO 20;")
DBI::dbExecute(
con,
glue::glue("CREATE TABLE bup AS SELECT * FROM read_csv_auto('{tsv_fp}', delim='\t', nullstr=\"NA\");")
)
DBI::dbDisconnect(con, shutdown=TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment