simonw / sqlite-utils

Python CLI utility and library for manipulating SQLite databases
https://sqlite-utils.datasette.io
Apache License 2.0
1.63k stars 111 forks source link

Show more information when JSON can't be imported with sqlite-utils insert #532

Closed voltagex closed 1 year ago

voltagex commented 1 year ago

I am currently trying to import the JSON export of my data from Discord, specifically activity/reporting/events-*.json

sqlite-utils.exe insert test.db reporting events-2023-00000-of-00001.json
  [###################################-]   99%  00:00:00
Error: Invalid JSON - use --csv for CSV or --tsv for TSV files

Please show more information as to why this is invalid, if possible.

I am using version 3.30 with Python 3.10 on Windows 11.

simonw commented 1 year ago

Was this a newline-delimited JSON file perhaps?

simonw commented 1 year ago

Here's an improvement:

% sqlite-utils insert /tmp/b.db blah /tmp/blah.txt
  [####################################]  100%
Error: Invalid JSON - use --csv for CSV or --tsv for TSV files

JSON error: Expecting value: line 1 column 1 (char 0)