try this https://developers.cloudflare.com/d1/learning/importing-data/
D1 allows you to import existing SQLite tables and their data directly, enabling you to migrate existing data into D1 quickly and easily. This can be …

wrangler.toml, why do we need to specify database_name? it seems redundant, given that you specify the database IDpreview_ :^)ms to s, but no, the query really did only take 0.3msstmt.raw() return an empty array or null if there are no results?
jq you can convert JSON input to CSV output in your terminal, thoughwrangler.tomldatabase_namepreview_sstmt.raw()[[d1_databases]]
binding = "MY_DB" # i.e. available in your Worker on env.DB
database_name = "...."
database_id = "..."jq