translate {SqlRender}R Documentation

Translates SQL from one dialect to another

Description

translate translates SQL from one dialect to another.

Usage

translate(
  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. Use listSupportedDialects to get the list of supported dialects.

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 tempEmulationSchema instead.

Details

This function takes SQL in one dialect and translates it into another. It uses simple pattern replacement, so its functionality is limited. Note that trailing semicolons are not removed for Oracle, which is required before sending a statement through JDBC. This will be done by splitSql.

Value

A character string containing the translated SQL.

Examples

translate("USE my_schema;", targetDialect = "oracle")

[Package SqlRender version 1.18.0 Index]