src_presto: dplyr integration to connect to a Presto database.

View source: R/dbplyr-src.R

src_prestoR Documentation

dplyr integration to connect to a Presto database.

Description

Allows you to connect to an existing database through a presto connection.

Usage

src_presto(
  catalog = NULL,
  schema = NULL,
  user = NULL,
  host = NULL,
  port = NULL,
  source = NULL,
  session.timezone = NULL,
  parameters = NULL,
  bigint = c("integer", "integer64", "numeric", "character"),
  con = NULL,
  ...
)

Arguments

catalog

Catalog to use in the connection

schema

Schema to use in the connection

user

User name to use in the connection

host

Host name to connect to the database

port

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

bigint

The R type that Presto's 64-bit integer (BIGINT) types should be translated to. The default is "integer", which returns R's integer type, but results in NA for values above/below +/-2147483647. "integer64" returns a bit64::integer64, which allows the full range of 64 bit integers. "numeric" coerces into R's double type but might result in precision loss. Lastly, "character" casts into R's character type.

con

An object that inherits from PrestoConnection, typically generated by DBI::dbConnect. When a valid connection object is supplied, Other arguments are ignored.

...

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.

Examples

## Not run: 
# To connect to a database
my_db <- src_presto(
  catalog = "memory",
  schema = "default",
  user = Sys.getenv("USER"),
  host = "http://localhost",
  port = 8080,
  session.timezone = "Asia/Kathmandu"
)
# Use a PrestoConnection
my_con <- DBI::dbConnect(
  catalog = "memory",
  schema = "default",
  user = Sys.getenv("USER"),
  host = "http://localhost",
  port = 8080,
  session.timezone = "Asia/Kathmandu"
)
my_db2 <- src_presto(con = my_con)

## End(Not run)

RPresto documentation built on Nov. 2, 2023, 5:58 p.m.