Member Junction
    Preparing search index...

    TypeScript client for the sqlglot Python microservice.

    Spawns a Python FastAPI process on 127.0.0.1 with an ephemeral port, then communicates via HTTP. The lifecycle methods start() and stop() manage the child process. Cleanup handlers are registered for SIGINT/SIGTERM.

    const client = new SqlGlotClient();
    await client.start();

    const result = await client.transpile({
    sql: "SELECT ISNULL(col, 0) FROM [dbo].[MyTable]",
    fromDialect: 'tsql',
    toDialect: 'postgres',
    });
    console.log(result.sql);

    await client.stop();
    Index

    Constructors

    Accessors

    • get IsRunning(): boolean

      Whether the Python microservice is currently running

      Returns boolean

    • get Port(): number

      The port the Python microservice is listening on, or null if not running

      Returns number

    Methods

    • List all supported SQL dialects.

      Returns Promise<string[]>

    • Start the Python microservice. Resolves once the server is ready. If already running, this is a no-op.

      Returns Promise<void>

    • Stop the Python microservice. Resolves once the process has exited. If not running, this is a no-op.

      Returns Promise<void>