-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathread_sql.Rd
32 lines (31 loc) · 1.44 KB
/
read_sql.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read.R
\name{read_sql}
\alias{read_sql}
\title{Uses boto3 (in python) to send an sql query to athena and return an R dataframe, tibble or data.table based on user preference.}
\usage{
read_sql(sql_query, return_df_as = "tibble")
}
\arguments{
\item{sql_query}{A string specifying the SQL query you want to send to athena. See packages github readme for info on the flavour of SQL Athena uses.}
\item{return_df_as}{String specifying what the table should be returned as i.e. 'dataframe', 'tibble' (converts data using tibble::as_tibble) or 'data.table' (converts data using data.table::as.data.table). Default is 'tibble'. Not all tables returned are a DataFrame class.}
}
\value{
A table as a dataframe, tibble or data.table
}
\description{
Uses boto3 (in python) to send an sql query to athena and return an R dataframe, tibble or data.table based on user preference.
}
\details{
Will send an SQL query to Athena and wait for it to complete. Once the query has completed the resulting sql query will be read using arrow.
Function returns dataframe. If needing more a more bespoke or self defined data reading function and arguments use dbtools::start_query_and_wait to send an SQL query and return the s3 path to data in csv format.
}
\examples{
# Read an sql query returning a tibble
```
df <- dbtools::read_sql(
"SELECT * from crest_v1.flatfile limit 10000",
return_df_as="tibble"
)
```
}