Skip to contents

Reads an .sql file and prepares it for use with dbplyr/odbc queries to SQL Server/Snowflake, etc.

Usage

read_sql(file_name)

Arguments

file_name

character string with the path and filename of the .sql file

Value

concise sql statement ready to be passed to SQL Server/Snowflake, etc.

Details

The original version of this function was developed by Thomas Huang.

Examples


if (FALSE) {
sql_statement <- read_sql(here::here("SQL/demo.sql"))

# use dbGetQuery for single SQL clauses
results <- ccdm_query(sql_statement)

# use snowsql for complex SQL statements with multiple clauses
results2 <- system2("~/bin/snowsql", glue("-f {sql_statement} -o quiet={quiet}"))

}