execute_sql_file: Execute a SQL file

View source: R/execute-sql-file.R

execute_sql_fileR Documentation

Execute a SQL file

Description

Read a SQL file, and execute its text using the odbc and DBI packages.

Usage

execute_sql_file(
  path_sql,
  dsn,
  execute = TRUE,
  minimum_row_count = 0L,
  timezone = "UTC",
  timezone_out = "UTC"
)

Arguments

path_sql

A vector to of names to convert. Required character.

dsn

The name of a DSN defined on your local machine Required character.

execute

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.

minimum_row_count

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.

timezone

The server time zone. Passed to DBI::dbConnect().

timezone_out

The time zone returned to R. Passed to DBI::dbConnect(). See https://www.tidyverse.org/blog/2019/12/odbc-1-2-0/.

Value

A vector of converted names.

Author(s)

Will Beasley

Examples

## Not run: 
execute_sql_file("inst/hdid-select.sql", "cdw_cache_staging")
execute_sql_file("inst/condense-date.sql", "cdw_cache_staging")

## End(Not run)

OuhscBbmc/OuhscMunge documentation built on Dec. 5, 2024, 4:34 a.m.