translateSingleStatement {SqlRender} | R Documentation |
Translates a single SQL statement from one dialect to another
Description
translateSingleStatement
translates a single SQL statement from one dialect to another.
Usage
translateSingleStatement(
sql = "",
targetDialect,
tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
oracleTempSchema = NULL
)
Arguments
sql |
The SQL to be translated |
targetDialect |
The target dialect. Currently "oracle", "postgresql", "pdw", "impala", "sqlite", "sqlite extended", "netezza", "bigquery", "snowflake", "synapse", "spark", and "redshift" are supported. |
tempEmulationSchema |
Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created. |
oracleTempSchema |
DEPRECATED: use |
Details
This function takes SQL in one dialect and translates it into another. It uses simple pattern replacement, so its functionality is limited. This removes any trailing semicolon as required by Oracle when sending through JDBC. An error is thrown if more than one statement is encountered in the SQL.
Value
A character vector with the translated SQL.
Examples
translateSingleStatement("USE my_schema;", targetDialect = "oracle")