Cloudflare D1 has added a new export mode that includes virtual tables—such as full‑text search (FTS5) and spatial index (R*Tree) tables—by setting the compatibility flag to sqlite3_cli_only. The change matters to AI, cloud, DevOps, and security teams because it finally enables reliable extraction of otherwise opaque data structures for debugging, compliance snapshots, or offline analysis, while also introducing new handling constraints.
Export Support for Virtual Tables
Previously, any D1 database that defined a virtual table caused the export operation to fail. The new behavior is triggered by adding a dump_options object with compatibility set to sqlite3_cli_only in the export API payload, or by passing the --compatibility sqlite3_cli_only flag to wrangler d1 export. The API call looks like this:
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/d1/database/$DATABASE_ID/export" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"output_format": "polling",
"dump_options": {
"compatibility": "sqlite3_cli_only"
}
}'
When this flag is present, the service produces a dump that the SQLite command‑line interface can read, including the schema and data of virtual tables.
Operational Impact
The ability to export virtual tables removes a long‑standing blocker for backup and forensic workflows. Teams can now schedule regular dumps of D1 instances that rely on full‑text search or geospatial indexing, store the resulting .sql files in secure object storage, and run SQLite queries locally for ad‑hoc analysis. However, the dump is explicitly marked as SQLite‑CLI‑only; the documentation states that importing the file back into D1 is not supported. Practically, this means the export is a one‑way operation: it is suitable for archival or inspection but not for cloning a D1 instance that uses virtual tables. For environments that need repeatable restores, engineers must keep a separate export path for databases without virtual tables or redesign the schema to avoid virtual tables where re‑import is required.
Security and Compliance Considerations
Because the dump contains raw table data, including potentially sensitive text indexed by FTS5, it must be treated as a privileged artifact. The export request still requires a valid Cloudflare API token, so token hygiene remains critical. Once the dump is generated, standard data‑at‑rest controls—encryption, access‑restricted storage buckets, and audit logging—should be applied. The fact that the dump cannot be re‑imported into D1 reduces the risk of accidental overwrites, but it also means that any compromised dump cannot be used to re‑populate a production D1 instance, limiting the attack surface.
Related CloudNinjas coverage: hands-on guides.
What This Means For Practitioners
- Update backup scripts to include the
sqlite3_cli_onlycompatibility flag when exporting D1 databases that contain virtual tables. - Validate that downstream processes (e.g., compliance audits, data science pipelines) can consume SQLite‑CLI dumps directly.
- Do not rely on the dump for disaster‑recovery of virtual‑table‑enabled databases; maintain a separate strategy for restoring such workloads.
- Secure the generated dump with encryption and strict access controls, and rotate the API token used for export regularly.
- Monitor Cloudflare API responses for any future changes to import capabilities that could affect your backup design.

