mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54:31 +02:00
sqlite-utils convert can now use callable references, closes #686
This now works:
echo '{"date": "13th January 2025"}' | sqlite-utils insert dates.db dates -
sqlite-utils convert dates.db dates date r.parsedate
sqlite-utils rows dates.db dates
Previously the command would have been:
sqlite-utils convert dates.db dates date 'r.parsedate(value)'
This commit is contained in:
parent
f9e5fbb3bd
commit
5a7f522980
3 changed files with 74 additions and 3 deletions
14
docs/cli.rst
14
docs/cli.rst
|
|
@ -1849,7 +1849,19 @@ These recipes can be used in the code passed to ``sqlite-utils convert`` like th
|
|||
sqlite-utils convert my.db mytable mycolumn \
|
||||
'r.jsonsplit(value)'
|
||||
|
||||
To use any of the documented parameters, do this:
|
||||
You can also pass the recipe function directly without the ``(value)`` part - sqlite-utils will detect that it is a callable and use it automatically:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sqlite-utils convert my.db mytable mycolumn r.parsedate
|
||||
|
||||
This shorter syntax works for any callable, including functions from imported modules:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sqlite-utils convert my.db mytable mycolumn json.loads --import json
|
||||
|
||||
To use any of the documented parameters, use the full function call syntax:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue