Open simonw opened 1 year ago
The main blocker here is coming up with a design. The challenge is cleanly integrating it with the existing format options:
I'd like to avoid breaking backwards compatibility.
The most obvious solution is to add a --format x
option. This is slightly confusing as --fmt
already exists.
Or... --fmt
could be enhanced to handle plugins too - and the existing set of formats (from the tabulate
integration) could be refactored to use the new hook.
If I ever do release sqlite-utils 4
I'm tempted to move that tabulate stuff into a plugin.
I'm currently leaning very slightly towards --format geojson
- and explaining in the docs that --format
is for formats added by plugins.
A related feature would be support for plugins to add new ways of ingesting data - currently sqlite-utils insert
works against JSON, newline-JSON, CSV and TSV.
A related feature would be support for plugins to add new ways of ingesting data - currently sqlite-utils insert works against JSON, newline-JSON, CSV and TSV.
This is my goal, to have one plugin that handles input and output symmetrically. I'd like to be able to do something like this:
sqlite-utils insert data.db table file.geojson --format geojson
# ... explore and manipulate in Datasette
sqlite-utils query data.db ... --format geojson > output.geojson
This would work especially well with datasette-query-files, since I already have the queries I need saved in standalone SQL files.
I wonder if this should be two hooks: input and output. The current --csv
(and --tsv
) options apply to both. Haven't looked at how it's implemented. Or maybe it's one hook that returns a format for reading and for writing.
https://discord.com/channels/823971286308356157/997738192360964156/1133076679011602432