dbSDK
Resources

Postgres

First SQL driver: connection, introspection from information_schema, parameterized SELECT, limits and timeouts.

PostgreSQL is the first SQL driver. It should prove the core stays driver-agnostic: connection, introspection, parameterized SELECT, limits, and timeouts — not a SQL-shaped core that Firestore has to fake.

postgres.ts
import { connect } from "@db-sdk/core";
import { postgres } from "@db-sdk/postgres";

const db = await connect({
  provider: postgres({
    connectionString: process.env.DATABASE_URL,
  }),
});

await db.test();
const catalog = await db.introspect();
const users = await db.query({
  sql: "SELECT id, email FROM users WHERE plan = $1",
  params: ["pro"],
});

Intended query controls

  • Reject statements that are not SELECT or WITH … SELECT
  • Reject mutation, DDL, and multi-statement batches
  • Use parameterized queries — values are never concatenated
  • Enforce a row cap even if the query omits LIMIT
  • Enforce a statement timeout
Prefer a user with CONNECT and SELECT only. SDK SQL policy is extra, not the lock.