The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

RTrino

A DBI backend for Trino, the distributed SQL query engine (the successor of PrestoSQL).

RTrino talks to a Trino coordinator over its HTTP REST API, so there is no client library to install and nothing to compile. It is built on httr2 and on the sql_dialect() extension point introduced in dbplyr 2.6.0.

Installation

# install.packages("pak")
pak::pak("AngelCasasbl/RTrino")

Usage

library(DBI)
library(RTrino)

con <- dbConnect(
  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"))
)

dbGetQuery(con, "SELECT region, sum(amount) AS total FROM sales GROUP BY region")

library(dplyr)
tbl(con, "sales") |>
  filter(year == 2026) |>
  group_by(region) |>
  summarise(total = sum(amount, na.rm = TRUE)) |>
  collect()

dbDisconnect(con)

See vignette("getting-started", package = "RTrino") for authentication, certificate authorities, chunked fetching and the dplyr translations.

What it does

Limits

The vignette lists the few places where a dplyr translation cannot match R, such as round() on halves and the approximate median().

Authentication

Method Helper Typical use
Basic trino_auth_basic(user, password) LDAP, password file
Bearer JWT trino_auth_jwt(token) service accounts, pipelines
OAuth2 client credentials trino_auth_oauth2(client_id, client_secret, token_url) corporate SSO; the token is renewed automatically

Development

R 4.1.0 or newer. The test suite runs offline against a fake Trino coordinator built with webfakes, so no cluster is needed. The fake replays responses recorded from a real Trino (tests/testthat/fixtures, captured with dev/record-fixtures.R), so the tests read the payloads a cluster really sends:

devtools::test()
devtools::check()

With a Trino at hand, the integration tests in tests/testthat/test-live.R also run: they compare every value with Trino’s own rendering of it, and run the SQL of the dplyr translations against what R computes on the same rows.

# docker run --rm -d -p 8080:8080 --name trino trinodb/trino
Sys.setenv(RTRINO_TEST_URL = "http://localhost:8080")
devtools::test()

License

BSD 3-Clause. See LICENSE.md.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.