Skip to content

Changelog

New updates and improvements at Cloudflare.

Back to all posts

Export D1 databases with virtual tables

You can now export a D1 database that contains virtual tables, such as full-text search tables using SQLite's FTS5 module ↗︎ or spatial index tables using the R*Tree module. Previously, export failed for any database containing virtual tables.

To include virtual tables in the dump, set dump_options.compatibility to sqlite3_cli_only on the D1 export API. The same option is available as the --compatibility flag on wrangler d1 export.

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"
		}
	}'

For more information, refer to Export a D1 database with virtual tables.