Date Completed: November 4, 2017
By: Connor Lenio
The following is a brief guide on how to access tables connected to a Dremio Server using macOS and R. The documentation on the Dremio website did not give explicit instructions on how to get this working using the ODBC drivers, so I figured it out myself!
sessionInfo()
## R version 3.4.2 (2017-09-28)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Sierra 10.12.6
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] compiler_3.4.2 backports_1.1.0 magrittr_1.5 rprojroot_1.2
## [5] tools_3.4.2 htmltools_0.3.6 yaml_2.1.14 Rcpp_0.12.13
## [9] stringi_1.1.5 rmarkdown_1.6 knitr_1.16 stringr_1.2.0
## [13] digest_0.6.12 evaluate_0.10.1
brew install unixODBC
# make sure to use github version
devtools::install_github("r-dbi/odbc")
library(odbc)
odbc::odbcListDrivers()
cd /Library/ODBC/
nano odbcinst.ini
nano odbc.ini
cd /usr/local/Cellar/unixodbc/2.3.4/etc
library(odbc)
library(DBI)
library(tidyverse)
library(dbplyr)
dremio_host <- "localhost"
dremio_port <- "31010"
dremio_uid <- "your_username"
dremio_pwd <- "your_password"
con <- DBI::dbConnect(odbc::odbc(),
driver = "Dremio ODBC Driver",
uid = dremio_uid,
pwd = dremio_pwd,
host = dremio_host,
port = dremio_port,
AuthenticationType = "Basic Authentication", ConnectionType = "Direct")
arrange
function is included here to show how the table is ready for use with dplyr functions.con %>% tbl(sql('SELECT * FROM "@cojamalo".german_credit')) %>% arrange(Purpose)
dremio_tbl = con %>% tbl(sql('SELECT * FROM "@cojamalo".german_credit'))