Connect to a Presto database
Usage
Presto(...)
# S4 method for 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 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
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'sinteger
type, but results inNA
for values above/below +/-2147483647."integer64"
returns a bit64::integer64, which allows the full range of 64 bit integers."numeric"
coerces into R'sdouble
type but might result in precision loss. Lastly,"character"
casts into R'scharacter
type.- conn
A PrestoConnection object
Value
Presto A PrestoDriver object
dbConnect A PrestoConnection object
dbDisconnect A logical()
value indicating success
Examples
if (FALSE) {
conn <- dbConnect(Presto(),
catalog = "hive", schema = "default",
user = "onur", host = "localhost", port = 8080,
session.timezone = "US/Eastern", bigint = "character"
)
dbListTables(conn, "%_iris")
dbDisconnect(conn)
}