Connect to a Presto database
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)
Presto A PrestoDriver object
DBI::dbConnect()
A PrestoConnection object
DBI::dbDisconnect()
A logical()
value indicating success
currently ignored
A driver object generated by Presto()
The catalog to be used
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
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.
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).
A list()
of extra parameters to be passed in
the ‘X-Presto-Session’ header
A list of common table expressions (CTEs) that can be used in the
WITH clause. See
vignette("common-table-expressions")
.
An optional config list, as returned by
httr::config()
, to be sent with every HTTP request.
A boolean to indicate whether Trino request headers should be used. Default to FALSE.
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.
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.
A PrestoConnection object
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)
}
Run the code above in your browser using DataLab