loadRenderTranslateSql: Load, render, and translate a SQL file in a package

Description Usage Arguments Details Value Examples

Description

loadRenderTranslateSql Loads a SQL file contained in a package, renders it and translates it to the specified dialect

Usage

1
2
loadRenderTranslateSql(sqlFilename, packageName, dbms = "sql server", ...,
  oracleTempSchema = NULL)

Arguments

sqlFilename

The source SQL file

packageName

The name of the package that contains the SQL file

dbms

The target dialect. Currently 'sql server', 'oracle', 'postgres', and 'redshift' are supported

...

Parameter values used for renderSql

oracleTempSchema

A schema that can be used to create temp tables in when using Oracle.

Details

This function looks for a SQL file with the specified name in the inst/sql/<dbms> folder of the specified package. If it doesn't find it in that folder, it will try and load the file from the inst/sql/sql_server folder and use the translateSql function to translate it to the requested dialect. It will subsequently call the renderSql function with any of the additional specified parameters.

Value

Returns a string containing the rendered SQL.

Examples

1
2
3
4
5
6
7
## Not run: 
renderedSql <- loadRenderTranslateSql("CohortMethod.sql",
                                      packageName = "CohortMethod",
                                      dbms = connectionDetails$dbms,
                                      CDM_schema = "cdmSchema")

## End(Not run)

hxia/SqlRender4Impala documentation built on May 17, 2019, 9:15 p.m.