-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 12d11e4
Showing
15 changed files
with
1,112 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
^_targets\.R$ | ||
^\.Rprofile$ | ||
^report$ | ||
^report/_bookdown\.yml$ | ||
^report/_output\.yml$ | ||
^report/index\.Rmd$ | ||
^report/chapter1\.Rmd$ | ||
^report/chapter2\.Rmd$ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
if (file.exists("~/.Rprofile")) source("~/.Rprofile") | ||
|
||
if(!requireNamespace("pacman", quietly = TRUE)) { | ||
utils::install.packages("pacman") | ||
} | ||
|
||
pacman::p_load( | ||
magrittr, | ||
dplyr, | ||
tidyr, | ||
ggplot2, | ||
|
||
duckdb, | ||
arrow, | ||
DBI, | ||
odbc, | ||
|
||
targets, | ||
tarchetypes | ||
) | ||
|
||
library(conflicted) | ||
conflicted::conflict_prefer("filter", "dplyr", quiet = TRUE) | ||
conflicted::conflict_prefer("select", "dplyr", quiet = TRUE) | ||
conflicted::conflict_prefer("expand", "tidyr", quiet = TRUE) | ||
|
||
# make all fns available to {targets} (and interactively, via load_all) | ||
if (rlang::is_interactive()) { | ||
devtools::load_all() | ||
# delayedAssign("duckdb_con", connect_duckdb(), assign.env = globalenv()) | ||
# delayedAssign("pg_con", connect_pg(), assign.env = globalenv()) | ||
} else { | ||
invisible( | ||
lapply(list.files("./R", full.names = TRUE), source, encoding = "UTF-8") | ||
) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata | ||
_targets | ||
playground* | ||
.Rdata | ||
.httr-oauth | ||
.DS_Store |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Package: backend_compare | ||
Title: A {targets} pipeline to play around with {arrow} and {duckdb} | ||
Version: 0.0.0.9000 | ||
Authors@R: | ||
person("Eduardo", "Alfonso-Sierra", , "[email protected]", | ||
role = c("aut", "cre", "cph"), | ||
comment = c(ORCID = "0000-0001-6430-5135")) | ||
Description: Not really a package. Just a bunch of simple data wrangling steps | ||
to play around with {arrow} and {duckdb}, and compare it with | ||
the same thing in PostgreSQL | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
Language: en | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.1.2 | ||
Imports: | ||
targets, | ||
tarchetypes, | ||
visNetwork, | ||
duckdb, | ||
arrow, | ||
conflicted, | ||
dplyr, | ||
ggplot2, | ||
magrittr, | ||
pacman, | ||
rlang, | ||
tidyr, | ||
utils, | ||
DBI, | ||
odbc, | ||
fs, | ||
bench, | ||
efun, | ||
glue, | ||
here, | ||
purrr |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#backend | ||
#interface | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
connect_duckdb <- function(read_only = FALSE) { | ||
|
||
print("CONNECTING DuckDB ...") | ||
|
||
fs::dir_create(fs::path_dir("/backend/duckdb/backend.duckdb")) | ||
DBI::dbConnect( | ||
drv = duckdb::duckdb(), | ||
dbdir = "/backend/duckdb/backend.duckdb", | ||
read_only = read_only | ||
) | ||
} | ||
|
||
connect_pg <- function() { | ||
|
||
DBI::dbConnect( | ||
odbc::odbc(), | ||
driver = "PostgreSQL Unicode(x64)", | ||
database = "backend", | ||
uid = "postgres", | ||
pwd = "postgres", | ||
host = NULL, #,"localhost", | ||
port = 5432, | ||
encoding = "WINDOWS-1252", | ||
bigint = "numeric" | ||
) | ||
} | ||
|
||
connect_arrow <- function(arrow_tbl) { | ||
|
||
arrow::open_dataset( | ||
sources = arrow_tbl, | ||
format = "arrow" | ||
) | ||
} | ||
|
||
connect_parquet <- function(parquet_tbl) { | ||
|
||
arrow::open_dataset( | ||
sources = parquet_tbl, | ||
format = "parquet" | ||
) | ||
} | ||
|
Oops, something went wrong.