| dbConnect,TrinoDriver-method | R Documentation |
Creates a TrinoConnection. Trino's REST API is stateless, so no
session is opened on the server; the connection object holds the coordinator
address and the per-request settings. To fail early on a wrong address or
bad credentials, dbConnect() probes GET /v1/info before returning.
## S4 method for signature 'TrinoDriver'
dbConnect(
drv,
host = "http://localhost",
port = 8080L,
user = trino_default_user(),
catalog = NULL,
schema = NULL,
source = "RTrino",
session.timezone = "UTC",
bigint = c("integer64", "numeric", "character"),
auth = NULL,
ssl_options = trino_ssl(),
extra.headers = list(),
timeout = 60,
query_max_run_time = NULL,
allow_http_auth = FALSE,
...
)
drv |
A TrinoDriver object, from |
host |
Coordinator URL. A missing scheme defaults to |
port |
Coordinator port, a whole number between 1 and 65535. |
user |
Trino user name, sent as |
catalog |
Trino catalog. Required. |
schema |
Trino schema. Required. |
source |
Value of the |
session.timezone |
Session time zone, used when reading |
bigint |
How to return |
auth |
An authentication closure from |
ssl_options |
TLS options from |
extra.headers |
Named list of extra HTTP headers added to every
request, each a single string. Useful for Trino session properties set
through |
timeout |
Seconds allowed for each HTTP request to the coordinator,
not for the whole query; |
query_max_run_time |
Longest a query may run on the cluster before
Trino stops it, as a Trino duration such as |
allow_http_auth |
Set to |
... |
Unused, for compatibility with the generic. |
A TrinoConnection object.
A query is a series of HTTP requests, so two limits apply. timeout bounds
each request: a coordinator or network that stops answering fails with an
error instead of blocking the R session. query_max_run_time bounds the
query as a whole on the server: past it, Trino stops the query and RTrino
raises a trino_query_error whose error_name is "EXCEEDED_TIME_LIMIT".
In a Shiny app, where a blocked session blocks its user, set both.
# The examples in this package run against the coordinator that
# RTRINO_TEST_URL points at, such as "http://localhost:8080" for
# `docker run -p 8080:8080 trinodb/trino`. It has no authentication.
con <- DBI::dbConnect(
RTrino::Trino(),
host = Sys.getenv("RTRINO_TEST_URL"),
catalog = "tpch", schema = "tiny"
)
con
DBI::dbDisconnect(con)
# LDAP over TLS, with limits for use in a Shiny app
## Not run:
con <- DBI::dbConnect(
RTrino::Trino(),
host = "https://trino.example.com",
port = 443,
user = Sys.getenv("TRINO_USER"),
catalog = "hive",
schema = "analytics",
auth = trino_auth_basic(Sys.getenv("TRINO_USER"),
Sys.getenv("TRINO_PASSWORD")),
timeout = 30,
query_max_run_time = "5m"
)
DBI::dbDisconnect(con)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.