Skip to main content

transpile

Function transpile 

Source
pub fn transpile(
    sql: &str,
    read: DialectType,
    write: DialectType,
) -> Result<Vec<String>>
Expand description

Transpile SQL from one dialect to another.

§Arguments

  • sql - The SQL string to transpile
  • read - The source dialect to parse with
  • write - The target dialect to generate

§Returns

A vector of transpiled SQL statements

§Example

use polyglot_sql::{transpile, DialectType};

let result = transpile(
    "SELECT EPOCH_MS(1618088028295)",
    DialectType::DuckDB,
    DialectType::Hive
);