Presto: Connect to a Presto database

View source: R/Presto.R

PrestoR Documentation

Connect to a Presto database

Description

Connect to a Presto database

Usage

Presto(...)

## S4 method for signature 'PrestoDriver'
dbConnect(
  drv,
  catalog,
  schema,
  user,
  host = "localhost",
  port = 8080,
  source = methods::getPackageName(),
  session.timezone = "",
  output.timezone = "",
  parameters = list(),
  ctes = list(),
  request.config = httr::config(),
  use.trino.headers = FALSE,
  extra.credentials = "",
  bigint = c("integer", "integer64", "numeric", "character"),
  ...
)

## S4 method for signature 'PrestoConnection'
dbDisconnect(conn)

Arguments

...

currently ignored

drv

A driver object generated by Presto()

catalog

The catalog to be used

schema

The schema to be used

user

The current user

host

The presto host to connect to

port

Port to use for the connection

source

Source to specify for the connection

session.timezone

Time zone of the Presto server. 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. This value is passed to Presto server via the request headers.

output.timezone

The time zone using which TIME WITH TZ and TIMESTAMP values in the output should be represented. Default to the Presto server timezone (use ⁠show(<PrestoConnection>)⁠ to see).

parameters

A list() of extra parameters to be passed in the ‘X-Presto-Session’ header

ctes

[Experimental] A list of common table expressions (CTEs) that can be used in the WITH clause. See vignette("common-table-expressions").

request.config

An optional config list, as returned by httr::config(), to be sent with every HTTP request.

use.trino.headers

A boolean to indicate whether Trino request headers should be used. Default to FALSE.

extra.credentials

Extra credentials to be passed in the X-Presto-Extra-Credential or X-Trino-Extra-Credential header ( depending on the value of the use.trino.headers argument). Default to an empty string.

bigint

The R type that Presto's 64-bit integer (BIGINT) class 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.

conn

A PrestoConnection object

Value

Presto A PrestoDriver object

dbConnect A PrestoConnection object

dbDisconnect A logical() value indicating success

Examples

## Not run: 
conn <- dbConnect(Presto(),
  catalog = "hive", schema = "default",
  user = "onur", host = "localhost", port = 8080,
  session.timezone = "US/Eastern", bigint = "character"
)
dbListTables(conn, "%_iris")
dbDisconnect(conn)

## End(Not run)

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