Read a SQL file, and execute its text using the odbc
and DBI
packages.
execute_sql_file(
path_sql,
dsn,
execute = TRUE,
minimum_row_count = 0L,
timezone = "UTC",
timezone_out = "UTC"
)
A vector to of names to convert. Required character.
The name of a DSN defined on your local machine Required character.
Indicates if DBI::dbExecute()
should be used
(which typically returns a scalar). Otherwise, DBI::dbGetQuery()
is used,
(which will return a tibble::tibble
). Required logical
.
If execute
is false, the returned dataset should have at least this many rows, or an error will be thrown. Default of 0. Required integer.
The server time zone. Passed to DBI::dbConnect()
.
The time zone returned to R. Passed to DBI::dbConnect()
. See https://www.tidyverse.org/blog/2019/12/odbc-1-2-0/.
A vector of converted names.
if (FALSE) { # \dontrun{
execute_sql_file("inst/hdid-select.sql", "cdw_cache_staging")
execute_sql_file("inst/condense-date.sql", "cdw_cache_staging")
} # }