api.md
attributes
| source_path | references/d1/api.md |
|---|---|
| source_sha256 | 493f0ba467577578d4baf00df83d4ae561a6c2557fb767dd13ca6c6dbe04fa8d |
| source_url | https://github.com/cloudflare/skills/blob/47dfc2ce969bf62acf8bc231198ade4bb02712e0/skills/cloudflare/references/d1/api.md |
| supporting_skill_id | 40184 |
| upstream_revision | 47dfc2ce969bf62acf8bc231198ade4bb02712e0 |
D1 API Reference
Fetch the relevant API page before writing queries or assuming method signatures and return types.
| Task | Current documentation |
|---|---|
| Bind values and choose a query execution method | Prepared statement methods |
| Execute batches and understand transaction rollback; use database sessions | D1 Database API |
| Interpret results and query metadata | Return objects |
| Choose supported JavaScript values and TypeScript result types | Workers Binding API |
| Choose consistency constraints and carry bookmarks between requests | Read replication and Sessions API |
| Query from a server-side script outside Workers | REST query API |
| Handle query failures and transient errors | Debug D1 and retry queries |
| Test database queries and apply migrations in tests | Workers Vitest APIs: D1 |
Bind untrusted values with prepared statements; do not interpolate them into SQL. Parameters do not replace identifiers: choose dynamic table, column, or sort names from an application-controlled allowlist.
D1 sessions provide sequential consistency for replicated queries. They are not a way to extend query execution limits. Choose the starting constraint or bookmark from the application's consistency requirements using the replication guide.
Children
No children yet.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.