Skip to content

Commit

Permalink
use ark to create db
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Jun 8, 2018
1 parent ef2c797 commit 1635835
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ data/*
.Renviron
*.zip
*.tsv.bz2

*.sqlite
*.sql
18 changes: 5 additions & 13 deletions data-raw/create_db.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
library(readr)
library(dplyr)
library(DBI)
library(R.utils)
# remotes::install_github("cboettig/arkdb")

itis <- read_tsv("data/itis.tsv.bz2")
ncbi <- read_tsv("data/ncbi.tsv.bz2")
library(arkdb)

taxa <- bind_rows(itis, ncbi)
files <- fs::dir_ls("data/", glob="*.tsv.bz2")
db <- unark(files, dbname = "data/taxa.sqlite", lines = 1e6)

db_path <- "data/taxa.sql"
con <- dbConnect(RSQLite::SQLite(), dbname=db_path)
dbListTables(con)
dbWriteTable(con, "taxa", taxa)
dbDisconnect(con)
R.utils::bzip2(db_path)
R.utils::bzip2("data/taxa.sqlite")

0 comments on commit 1635835

Please sign in to comment.