workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: statement too long when importing to D1

Open robinmetral opened this issue 2 years ago • 2 comments

Which Cloudflare product(s) does this pertain to?

D1

What version(s) of the tool(s) are you using?

wrangler 3.17.1

What version of Node are you using?

19.9.0

What operating system are you using?

Linux (Ubuntu)

Describe the Bug

I'm trying to migrate a D1 DB using the legacy backend to the new backend but I get an error from the Cloudflare API: statement too long. The DB has a single table with only ~150 rows but some columns contain a lot of text, so I imagine that one or more rows must hit the API's statement length limit.

Is this expected? Is there another way to import larger rows into D1?

Please provide a link to a minimal reproduction

Not applicable

Please provide any relevant error logs

npx wrangler d1 execute <db> --file <dump>.sql                
🌀 Mapping SQL input into an array of statements
🌀 Parsing 148 statements
🌀 Executing on remote database <db> (uuid):
🌀 To execute on your local development database, pass the --local flag to 'wrangler d1 execute'

✘ [ERROR] A request to the Cloudflare API (/accounts/<id>/d1/database/<uuid>/query) failed.

  statement too long [code: 7500]

robinmetral avatar Nov 25 '23 08:11 robinmetral