Package RPresto. July 13, 2017

Similar documents
Package RODBCDBI. August 29, 2016

Package odbc. October 4, 2017

Package RPostgres. April 6, 2018

Package RPostgres. December 6, 2017

Package dbx. July 5, 2018

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package MonetDB.R. March 21, 2016

Package implyr. May 17, 2018

Package postgistools

Package fastdummies. January 8, 2018

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package DatabaseConnector

Package ECctmc. May 1, 2018

Package githubinstall

Package opencage. January 16, 2018

Package MonetDBLite. January 14, 2018

Package calpassapi. August 25, 2018

Package messaging. May 27, 2018

Package DatabaseConnector

Package condusco. November 8, 2017

Package tidyimpute. March 5, 2018

Package DBI. June 18, 2017

Package spark. July 21, 2017

Package datasets.load

Package dkanr. July 12, 2018

Package ompr. November 18, 2017

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package knitrprogressbar

Package RODBCext. July 31, 2017

Package taxizedb. June 21, 2017

Package clipr. June 23, 2018

Package farver. November 20, 2018

Package gtrendsr. October 19, 2017

Package readobj. November 2, 2017

Package chunked. July 2, 2017

Package repec. August 31, 2018

Package facerec. May 14, 2018

Package robotstxt. November 12, 2017

Package wrswor. R topics documented: February 2, Type Package

Package available. November 17, 2017

Package reconstructr

Package crossword.r. January 19, 2018

Package validara. October 19, 2017

Package pool. November 4, 2017

Package strat. November 23, 2016

Package bigqueryr. October 23, 2017

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package hyphenatr. August 29, 2016

Package aws.transcribe

Package fingertipsr. May 25, Type Package Version Title Fingertips Data for Public Health

Package pbmcapply. August 16, 2017

Package rgdax. January 7, 2019

Package nodbi. August 1, 2018

Package geogrid. August 19, 2018

Package data.world. April 5, 2018

Package canvasxpress

Package nngeo. September 29, 2018

Package elasticsearchr

Package fst. December 18, 2017

Package textstem. R topics documented:

Package gtrendsr. August 4, 2018

Package darksky. September 20, 2017

Package fst. June 7, 2018

Package docxtools. July 6, 2018

Package bigqueryr. June 8, 2018

Package DBI. February 15, 2013

Package ether. September 22, 2018

Package postal. July 27, 2018

Package kirby21.base

Package promote. November 15, 2017

Package sessioninfo. June 21, 2017

Package mdftracks. February 6, 2017

Package lexrankr. December 13, 2017

Package comparedf. February 11, 2019

Package guardianapi. February 3, 2019

Package internetarchive

Package sfc. August 29, 2016

Package rzeit2. January 7, 2019

Package cregulome. September 13, 2018

Package patentsview. July 12, 2017

Package rgho. R topics documented: January 18, 2017

Package purrrlyr. R topics documented: May 13, Title Tools at the Intersection of 'purrr' and 'dplyr' Version 0.0.2

Package wikitaxa. December 21, 2017

Package jstree. October 24, 2017

Package rdryad. June 18, 2018

Package oec. R topics documented: May 11, Type Package

Package pkgbuild. October 16, 2018

Package osrm. November 13, 2017

Package readxl. April 18, 2017

Package rsdmx. September 21, 2018

Package IATScore. January 10, 2018

R topics documented: 2 clone

Package autocogs. September 22, Title Automatic Cognostic Summaries Version 0.1.1

Package resumer. R topics documented: August 29, 2016

Package raker. October 10, 2017

Package kdtools. April 26, 2018

Package tibble. August 22, 2017

Package bisect. April 16, 2018

The DBI Package. R topics documented: January 28, Version Date Title R Database Interface

Package semver. January 6, 2017

Transcription:

Title DBI Connector to Presto Version 1.3.0 Copyright Facebook, Inc. 2015-present. Package RPresto July 13, 2017 Implements a 'DBI' compliant interface to Presto. Presto is an open source distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes: <https://prestodb.io/>. Depends R (>= 3.1.0), methods Imports DBI (>= 0.3.0), httr (>= 0.6), openssl, jsonlite, stringi, stats, Rcpp, utils Suggests testthat, dplyr (>= 0.4.3), dbplyr License BSD_3_clause + file LICENSE URL https://github.com/prestodb/rpresto BugReports https://github.com/prestodb/rpresto/issues Encoding UTF-8 LazyData true Collate 'PrestoDriver.R' 'Presto.R' 'utility_functions.r' 'PrestoSession.R' 'PrestoConnection.R' 'PrestoCursor.R' 'PrestoResult.R' 'RcppExports.R' 'copy.to.src.presto.r' 'db.data.type.prestoconnection.r' 'dbplyr_compatible.r' 'db.explain.prestoconnection.r' 'db.query.rows.prestoconnection.r' 'dbhascompleted.r' 'dbclearresult.r' 'dbconnect.r' 'dbdatatype.r' 'dbdisconnect.r' 'dbsendquery.r' 'json.tabular.to.data.frame.r' 'extract.data.r' 'dbfetch.r' 'dbgetquery.r' 'dblisttables.r' 'dbexiststable.r' 'dbgetinfo.r' 'dbgetrowcount.r' 'dbgetstatement.r' 'dbisvalid.r' 'dblistfields.r' 'dbunloaddriver.r' 'description_from_info.r' 'db_desc.prestoconnection.r' 'db_query_fields.r' 'fetch.r' 'help.r' 'src.translate.env.src.presto.r' 'sql_translate_env.r' 'src.desc.src.presto.r' 'src.presto.r' 'tbl.src.presto.r' RoxygenNote 6.0.1 1

2 dbdatatype,prestodriver-method LinkingTo Rcpp NeedsCompilation yes Author Onur Ismail Filiz [aut, cre], Sergey Goder [aut], John Myles White [ctb] Maintainer Onur Ismail Filiz <onur@fb.com> Repository CRAN Date/Publication 2017-07-13 15:40:23 UTC R topics documented: dbdatatype,prestodriver-method............................. 2 dbgetinfo,prestodriver-method.............................. 3 Presto............................................ 4 PrestoCursor-class..................................... 5 PrestoSession-class..................................... 6 RPresto........................................... 6 src_presto.......................................... 6 Index 8 dbdatatype,prestodriver-method Return the corresponding presto data type for the given R object Return the corresponding presto data type for the given R object Usage ## S4 method for signature 'PrestoDriver' dbdatatype(dbobj, obj,...) Arguments dbobj A PrestoDriver object obj Any R object... Extra optional parameters, not currently used Details The default value for unknown classes is VARCHAR. ARRAY s and MAP s are supported with some caveats. Unnamed lists will be treated as AR- RAY s and named lists will be a MAP. All items are expected to be of the same corresponding Presto type, otherwise the default VARCHAR value is returned. The key type for MAP s is always VARCHAR. The value type for empty lists is always a VARCHAR.

dbgetinfo,prestodriver-method 3 Value A character value corresponding to the Presto type for obj drv <- RPresto::Presto() dbdatatype(drv, list()) dbdatatype(drv, 1) dbdatatype(drv, NULL) dbdatatype(drv, list(list(list(a=sys.date())))) dbdatatype(drv, as.posixct('2015-03-01 00:00:00', tz='utc')) dbdatatype(drv, Sys.time()) # Data types for ARRAY or MAP values can be tricky all.equal('varchar', dbdatatype(drv, list(1, 2, 3L))) dbgetinfo,prestodriver-method Metadata about database objects Usage Metadata about database objects For the PrestoResult object, the implementation returns the additional stats field which can be used to implement things like progress bars. See the examples section. ## S4 method for signature 'PrestoDriver' dbgetinfo(dbobj) ## S4 method for signature 'PrestoConnection' dbgetinfo(dbobj) ## S4 method for signature 'PrestoResult' dbgetinfo(dbobj) Arguments dbobj A PrestoDriver, PrestoConnection or PrestoResult object Value PrestoResult A list with elements statement The SQL sent to the database row.count Number of rows fetched so far has.completed Whether all data has been fetched stats Current stats on the query

4 Presto ## Not run: conn <- dbconnect(presto(), 'localhost', 7777, 'onur', 'datascience') result <- dbsendquery(conn, 'SELECT * FROM jonchang_iris') iris <- data.frame() progress.bar <- NULL while (!dbhascompleted(result)) { chunk <- dbfetch(result) if (!NROW(iris)) { iris <- chunk } else if (NROW(chunk)) { iris <- rbind(iris, chunk) } stats <- dbgetinfo(result)[['stats']] if (is.null(progress.bar)) { progress.bar <- txtprogressbar(0, stats[['totalsplits']], style=3) } else { settxtprogressbar(progress.bar, stats[['completedsplits']]) } } close(progress.bar) ## End(Not run) Presto Connect to a Presto database Usage Connect to a Presto database Presto(...) ## S4 method for signature 'PrestoDriver' dbconnect(drv, catalog, schema, user, host = "localhost", port = 8080, source = getpackagename(), session.timezone = "UTC", parameters = list(),...) ## S4 method for signature 'PrestoConnection' dbdisconnect(conn) Arguments... currently ignored drv catalog A driver object generated by Presto The catalog to be used

PrestoCursor-class 5 schema user host port source The schema to be used The current user The presto host to connect to Port to use for the connection Source to specify for the connection session.timezone Time zone to use for the connection. Presto returns timestamps without time zones with respect to this value. The time arithmetic (e.g. adding hours) will also be done in the given time zone. See the session.timezone tests for examples. parameters conn A list of extra parameters to be passed in the X-Presto-Session header A PrestoConnection object Value Presto A PrestoDriver object [dbconnect] A PrestoConnection object [dbdisconnect] A logical value indicating success ## Not run: conn <- dbconnect(presto(), catalog = 'hive', schema = 'default', user = 'onur', host = 'localhost', port = 8080, session.timezone='us/eastern') dblisttables(conn, '%_iris') dbdisconnect(conn) ## End(Not run) PrestoCursor-class Internal implementation detail class needed for its side-effects. When dbfetch is called, we need to both return the data and update the uri to the next value. Internal implementation detail class needed for its side-effects. When dbfetch is called, we need to both return the data and update the uri to the next value.

6 src_presto PrestoSession-class Internal implementation detail class needed for its side-effects. When SET/RESET SESSION queries are called, session parameters need to be maintained by the client and requires an in-place update. Internal implementation detail class needed for its side-effects. When SET/RESET SESSION queries are called, session parameters need to be maintained by the client and requires an in-place update. RPresto RPresto A DBI-compliant interface to Presto. library("dbi") library("rpresto") src_presto dplyr integration to connect to a Presto database. Usage Allows you to connect to an existing database through a presto connection. Use src_presto to connect to an existing database, and tbl to connect to tables within that database. If you re unsure of the arguments to pass, please ask your database administrator for the values of these variables. src_presto(catalog = NULL, schema = NULL, user = NULL, host = NULL, port = NULL, source = NULL, session.timezone = NULL, parameters = NULL,...) tbl.src_presto(src, from,...)

src_presto 7 Arguments catalog schema user host port Catalog to use in the connection Schema to use in the connection User name to use in the connection Host name to connect to the database Port number to use with the host name source Source to specify for the connection session.timezone Time zone for the connection parameters Additional parameters to pass to the connection... For src_presto other arguments passed on to the underlying database connector dbconnect. For tbl.src_presto, it is included for compatibility with the generic, but otherwise ignored. src from A presto src created with src_presto. Either a string giving the name of table in database, or sql described a derived table or compound join. ## Not run: # To connect to a database my_db <- src_presto(catalog = "hive", schema = "web", user = "onur", host = "localhost", port = 8888, session.timezone='asia/kathmandu') ## End(Not run) ## Not run: First create a database connection with src_presto, then reference a tbl within that database my_tbl <- tbl(my_db, "my_table") ## End(Not run)

Index dbconnect,prestodriver-method (Presto), 4 dbdatatype,prestodriver-method, 2 dbdisconnect,prestoconnection-method (Presto), 4 dbgetinfo,prestoconnection-method (dbgetinfo,prestodriver-method), 3 dbgetinfo,prestodriver-method, 3 dbgetinfo,prestoresult-method (dbgetinfo,prestodriver-method), 3 list, 3, 5 logical, 5 package-rpresto (RPresto), 6 Presto, 4, 4 PrestoConnection, 3, 5 PrestoCursor (PrestoCursor-class), 5 PrestoCursor-class, 5 PrestoDriver, 2, 3, 5 PrestoResult, 3 PrestoSession (PrestoSession-class), 6 PrestoSession-class, 6 RPresto, 6 RPresto-package (RPresto), 6 sql, 7 src_presto, 6 tbl.src_presto (src_presto), 6 8