Rendering Parameterized SQL and Translation to Dialects

A rendering tool for parameterized SQL that also translates into different SQL dialects. These dialects include Sql Server, Oracle, PostgreSql, Amazon RedShift, and Microsoft PDW.



This is an R package for rendering parameterized SQL, and translating it to different SQL dialects. SqlRender can also be used as a stand-alone Java library.


  • Supports a simple markup syntax for making SQL parameterized, and renders parameterized SQL (containing the markup syntax) to executable SQL
  • The syntax supports defining default parameter values
  • The syntax supports if-then-else structures
  • Has functions for translating SQL from one dialect (Microsoft SQL Server) to other dialects (Oracle, PostgreSQL, Amazon RedShift, Microsoft PDW)


This exampe shows the use of parameters, as well as SqlRender's {if} ? {then} : {else} syntax:

sql <- renderSql("SELECT * FROM @a; {@b != ''}?{USE @b;}", a = "my_table", b = "my_schema")$sql

will produce the variable sql containing this value:

"SELECT * FROM my_table; USE my_schema;"

subsequently running this code

sql <- translateSql(sql, "sql server", "oracle")$sql

will produce the variable sql containing this value:

"SELECT * FROM my_table; ALTER SESSION SET current_schema =  my_schema;"


The SqlRender package is an R package wrapped around a Java library. The rJava package is used as interface.

The Java library is available as a JAR file.

System Requirements

Running the package requires R with the package rJava installed. Also requires Java 1.6 or higher.


  • There are no dependencies.

Getting Started =============== Use these commands in R to download and install the SqlRender package:


You can fetch the JAR file in the inst/java folder of this repository, or use Maven:

  1. First add the SqlRender repository so that maven can find and download the SqlRender artifact automatically:

2: Include the SqlRender dependency in your pom.xml


Getting Involved


SqlRender is licensed under Apache License 2.0


SqlRender is being developed in R Studio.

###Development status

Stable. The code is actively being used in several projects.


  • This project is supported in part through the National Science Foundation grant IIS 1251151.


SqlRender v1.1.7 (Release date: 2016-08-15)

Changes: initial submission to CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.2.0 by Martijn Schuemie, a month ago

Report a bug at

Browse source code at

Authors: Martijn J. Schuemie [aut, cre], Marc A. Suchard [aut],

Documentation:   PDF Manual  

Apache License 2.0 license

Imports rJava

Suggests testthat, knitr, rmarkdown

See at CRAN