GitHub

API reference for d1.

Cloudflare D1 (Effect's @effect/sql-d1): an SqlClient with SQLite's SQL over D1's HTTP API, sent with the HttpClient in context::

from pyfect.http import httpx_client
from pyfect.sql import d1

layer = d1.layer(
    d1.D1ClientConfig(account_id=..., database_id=..., api_token=fx.redacted.make(token))
).pipe(fx.provide(httpx_client.layer))
  • client: D1Client (an SqlClient with batch, its config and api), make, layer, layer_config, layer_from
  • config: D1ClientConfig
  • api: D1Api, the HTTP API underneath (query, raw), its results (D1Result, D1RawResult, D1Meta) and D1ApiError

D1 has no transactions, so with_transaction and pyfect.sql.migrator (which runs migrations in one) die with NotImplementedError, as in Effect; apply migrations with wrangler d1 migrations apply.

Re-exports

Modules