framework docs
Database

db_query()

Get data from a database query

Gets data from a database using a query and connection name. The connection is created, used, and automatically closed.

Usage

db_query(query, connection_name, ...)

Arguments

query
SQL query to execute
connection_name
Name of the connection in config.yml
...
Additional arguments passed to DBI::dbGetQuery

Value

A data frame with the query results

Examples

if (FALSE) {
users <- db_query("SELECT * FROM users", "my_db")
}