Description Usage Arguments Details Value Examples
Reads an .sql file and prepares it for use with dbplyr/odbc queries to SQL Server/Snowflake, etc.
1 | read_sql(file_name)
|
file_name |
character string with the path and filename of the .sql file |
The original version of this function was developed by Thomas Huang.
concise sql statement ready to be passed to SQL Server/Snowflake, etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
conn <- connect_cdw()
sql_statement <- read_sql(here::here("SQL/demo.sql"))
# use dbGetQuery for single SQL clauses
results <- DBI::dbGetQuery(conn, sql_statement)
# use snowsql for complex SQL statements with multiple clauses
results2 <- system2("~/bin/snowsql", glue("-f {sql_statement} -o quiet={quiet}"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.