Skip to main content
TeeSQL speaks the standard PostgreSQL wire protocol, so any Postgres driver connects once the mutual RA-TLS handshake is established. The libraries listed here add the attestation layer: they fetch a TDX-attested client certificate, verify the database’s TDX quote, and only then bridge bytes to the driver. Use them whenever your application code must refuse to query an unattested database.

Prerequisites

  • Your application running inside an Intel TDX CVM (or against the dstack simulator for local dev)
  • A connection string — see Connection string
  • An Intel Trust Authority API key, or the local DCAP verifier (Rust today; Python wheel pending)

Standard Postgres compatibility

Any standard Postgres client works against TeeSQL once TLS is configured correctly — see SSL & TLS. Such clients do not verify the database’s TDX attestation; they only verify the X.509 chain, which means a misconfigured operator could swap the backing CVM without the client noticing. Use a TeeSQL RA-TLS library when that matters.

RA-TLS client libraries

All three share the same shape: a localhost TCP forwarder owns the mutual RA-TLS handshake, your driver speaks plain Postgres to that forwarder, the handshake happens once at process start.

Minimal example

Development verifiers

In simulator mode the database’s certificate is self-signed and there is no TDX quote to verify. All three libraries ship a NoopVerifier for this case — never use it in production.

ORM integration

Prisma

prisma-ra-tls is a Prisma driver adapter. Enable the preview feature in schema.prisma:
schema.prisma
Install peer dependencies:
Pass the adapter when constructing PrismaClient (see the TypeScript example above). Requires Node.js ≥ 18 and Prisma ≥ 5.10. Drizzle, TypeORM, Sequelize, Knex, and SQLAlchemy adapters are not currently available.

Verification options

Each library exposes the same knobs for pinning the database identity: See Verify attestation for how to derive the right MRTD value for your cluster.

Verifier-only libraries

If you need to verify a TDX quote without going through a database driver — for example, to check the sidecar’s /attestation endpoint — use the verification primitives directly:
  • Python: ra-tls-verifyextract_tdx_quote, IntelApiVerifier, NoopVerifier. The Python DcapVerifier wheel is pending.
  • Rust: ra-tls-parse for cert/chain parsing into rustls types; quote verification via dcap-qvl (used internally by sqlx-ra-tls).

Worked example

teesql-example-python is a runnable FastAPI app that demonstrates the production shape: two long-lived psycopg connections (teesql_readwrite for writes, teesql_read for a polling task), OperationalError reconnect-once on failover, and a WebSocket fan-out backed by the secondary. Fork it as the starting point for your own service.
Last modified on May 1, 2026