dbSendQuery-TrinoConnection-character-method: Submit a statement to Trino

dbSendQuery,TrinoConnection,character-methodR Documentation

Submit a statement to Trino

Description

Posts the statement to ⁠/v1/statement⁠ and returns immediately with a TrinoResult cursor; the rows are pulled by dbFetch(). A statement that fails during planning raises an error here, because Trino reports it in the response to the initial POST.

Usage

## S4 method for signature 'TrinoConnection,character'
dbSendQuery(conn, statement, ...)

Arguments

conn

A TrinoConnection object.

statement

A single SQL statement, without a trailing semicolon.

...

Unused, for compatibility with the generic.

Details

Query parameters are not supported: passing params is an error rather than being silently ignored. Put values into the statement with DBI::sqlInterpolate() or glue::glue_sql(), which quote them with DBI::dbQuoteLiteral() as Trino literals.

Value

A TrinoResult object.

Examples


con <- DBI::dbConnect(RTrino::Trino(), host = Sys.getenv("RTRINO_TEST_URL"),
                      catalog = "tpch", schema = "tiny")
res <- DBI::dbSendQuery(con, "SELECT 1 AS n")
DBI::dbFetch(res)
DBI::dbClearResult(res)

# Values go into the SQL as literals, quoted for Trino
sql <- DBI::sqlInterpolate(
  con, "SELECT count(*) AS n FROM orders WHERE orderdate >= ?since",
  since = as.Date("1998-01-01")
)
DBI::dbGetQuery(con, sql)

DBI::dbDisconnect(con)


RTrino documentation built on Oct. 15, 2026, 5:08 p.m.