| sql_transpile | R Documentation |
Parses sql with the from dialect and regenerates it in the to
dialect, rewriting functions, quoting, and constructs as needed
(e.g. MySQL IFNULL() becomes PostgreSQL COALESCE()).
sql_transpile(
sql,
from,
to,
pretty = FALSE,
unsupported = c("raise", "warn", "ignore")
)
sql |
A single character string with one or more SQL statements
(separated by |
from |
Source dialect name (see |
to |
Target dialect name (see |
pretty |
If |
unsupported |
How to handle constructs that cannot be represented in
the target dialect: |
A character vector with one element per input statement.
Transpilation is syntactic and best-effort: identical syntax can still
behave differently across engines (implicit casts, collations, NULL
ordering, integer division, time zone handling...). Always test the
translated SQL against the target database before using it in production.
sql_format(), sql_parse(), sql_validate()
sql_transpile("SELECT IFNULL(a, b) FROM t", from = "mysql", to = "postgres")
sql_transpile(
"SELECT DATE_TRUNC('month', created_at) FROM events",
from = "postgres", to = "duckdb"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.