How to load a sqlite file in D1

I have a database locally and have a SQLite file. Is it possible to load that sqlite file on D1?

1 Like

You could connect to your D1 with d1-console. There you get a usual SQL prompt, which should enable uploads and all kinds of other things.

Wrangler also enables a number of direct DB interactions.

1 Like

If you want to use wrangler, then you need to dump the sqlite file to sql first. Something like this:

sqlite3 db.sqlite3 .dump > db.sql
npx wrangler d1 execute mydb --file db.sql
1 Like