renderSqlFile: Render a SQL file

Description Usage Arguments Details Examples

View source: R/HelperFunctions.R

Description

renderSqlFile Renders SQL code in a file based on parameterized SQL and parameter values, and writes it to another file.

Usage

1
renderSqlFile(sourceFile, targetFile, ...)

Arguments

sourceFile

The source SQL file

targetFile

The target SQL file

...

Parameter values

Details

This function takes parameterized SQL and a list of parameter values and renders the SQL that can be send to the server. Parameterization syntax:

@parameterName

Parameters are indicated using a @ prefix, and are replaced with the actual values provided in the renderSql call.

{DEFAULT @parameterName = parameterValue}

Default values for parameters can be defined using curly and the DEFAULT keyword.

{if}?{then}:{else}

The if-then-else pattern is used to turn on or off blocks of SQL code.

Examples

1
2
3
4
## Not run: 
renderSqlFile("myParamStatement.sql", "myRenderedStatement.sql", a = "myTable")

## End(Not run)

hxia/SqlRender4Impala documentation built on May 17, 2017, 12:06 a.m.