Query: Execute a query on Athena

Description Usage Arguments Value See Also Examples

Description

The dbSendQuery() and dbSendStatement() method submits a query to Athena but does not wait for query to execute. dbHasCompleted method will need to ran to check if query has been completed or not. The dbExecute() method submits a query to Athena and waits for the query to be executed.

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'AthenaConnection,character'
dbSendQuery(conn, statement = NULL, ...)

## S4 method for signature 'AthenaConnection,character'
dbSendStatement(conn, statement = NULL, ...)

## S4 method for signature 'AthenaConnection,character'
dbExecute(conn, statement = NULL, ...)

Arguments

conn

A DBIConnection object, as returned by dbConnect().

statement

a character string containing SQL.

...

Other parameters passed on to methods.

Value

Returns AthenaResult s4 class.

See Also

dbSendQuery, dbSendStatement, dbExecute

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# Note: 
# - Require AWS Account to run below example.
# - Different connection methods can be used please see `noctua::dbConnect` documnentation

library(DBI)

# Demo connection to Athena using profile name 
con <- dbConnect(noctua::athena())

# Sending Queries to Athena
res1 <- dbSendQuery(con, "show databases")
res2 <- dbSendStatement(con, "show databases")
res3 <- dbExecute(con, "show databases")

# Disconnect conenction
dbDisconnect(con)

## End(Not run)

noctua documentation built on Sept. 23, 2021, 5:12 p.m.