sql-builder

Lingua Tungga → TypeScript, Python, Go

Drizzle-compatible · sourced in Lingua Tungga

Write the query once.
Prove the bytes.

sql-builder is a SQL builder and schema codegen with a single source. It emits TypeScript, Python, and Go that produce the same SQL and parameters as drizzle-orm@0.44.4 — checked case by case, not asserted in prose.

Both engines, in your browser

Change the query. The left side is this repository's TypeScript port; the right side is drizzle-orm@0.44.4. They should never differ — not by a character, not by a parameter.

sql-builder

default query
select "id", "name", "active", "age", "email", "role" from "users" where "users"."id" = $1

params [1]

The live comparison with drizzle-orm loads with JavaScript. The query above is rendered without it.

01

Schema in

Prisma introspects the database. DMMF becomes schema.json, a versioned intermediate representation — not a copy of Prisma, just the facts codegen needs.

{
  "model": "users",
  "columns": [
    { "name": "id", "type": "Int",
      "default": { "kind": "autoincrement" } },
    { "name": "name", "type": "Str" },
    { "name": "age", "type": "Int" }
  ]
}

02

One source

The builder is written once in .lt, then emitted per target. The TypeScript surface reads like Drizzle because it is the same semantics, ported — not a wrapper around it.

import { eq } from "drizzle-orm";

db.select()
  .from(users)
  .where(eq(users.id, 1));

03

Same bytes out

Every case is rendered for three dialects and compared against the recorded Drizzle output. Parameters are bound, never inlined.

  • Postgresselect "id" from "users" where "users"."id" = $1params: int:1
  • MySQLselect `id` from `users` where `users`.`id` = ?params: int:1
  • SQLiteselect "id" from "users" where "users"."id" = ?params: int:1

The claim is the product

A port that cannot be compared is not a port. The parity gallery runs 41 cases across 3 targets and 3 dialects, plus a database roundtrip, and fails the build when a single byte differs.

Parity cases
41
Targets
3
Dialects
3
Allowed drift
0