| dbSendQuery,TrinoConnection,character-method | R Documentation |
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.
## S4 method for signature 'TrinoConnection,character'
dbSendQuery(conn, statement, ...)
conn |
A TrinoConnection object. |
statement |
A single SQL statement, without a trailing semicolon. |
... |
Unused, for compatibility with the generic. |
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.
A TrinoResult object.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.