Update sqlite-utils convert --help, refs #686

This commit is contained in:
Simon Willison 2026-07-07 18:03:25 -07:00
commit aa300942bf
2 changed files with 13 additions and 3 deletions

View file

@ -621,6 +621,11 @@ See :ref:`cli_convert`.
"value" is a variable with the column value to be converted.
CODE can also be a reference to a callable that takes the value, for example:
sqlite-utils convert my.db mytable date r.parsedate
sqlite-utils convert my.db mytable data json.loads --import json
Use "-" for CODE to read Python code from standard input.
The following common operations are available as recipe functions:
@ -634,7 +639,6 @@ See :ref:`cli_convert`.
errors: 'Optional[object]' = None) -> 'Optional[str]'
Parse a date and convert it to ISO date format: yyyy-mm-dd
- dayfirst=True: treat xx as the day in xx/yy/zz
- yearfirst=True: treat xx as the year in xx/yy/zz
- errors=r.IGNORE to ignore values that cannot be parsed
@ -644,7 +648,6 @@ See :ref:`cli_convert`.
False, errors: 'Optional[object]' = None) -> 'Optional[str]'
Parse a datetime and convert it to ISO datetime format: yyyy-mm-ddTHH:MM:SS
- dayfirst=True: treat xx as the day in xx/yy/zz
- yearfirst=True: treat xx as the year in xx/yy/zz
- errors=r.IGNORE to ignore values that cannot be parsed

View file

@ -3054,6 +3054,12 @@ def _generate_convert_help():
"value" is a variable with the column value to be converted.
CODE can also be a reference to a callable that takes the value, for example:
\b
sqlite-utils convert my.db mytable date r.parsedate
sqlite-utils convert my.db mytable data json.loads --import json
Use "-" for CODE to read Python code from standard input.
The following common operations are available as recipe functions:
@ -3067,8 +3073,9 @@ def _generate_convert_help():
]
for name in recipe_names:
fn = getattr(recipes, name)
doc = textwrap.dedent(fn.__doc__.rstrip()).replace("\b\n", "")
help += "\n\nr.{}{}\n\n\b{}".format(
name, str(inspect.signature(fn)), textwrap.dedent(fn.__doc__.rstrip())
name, str(inspect.signature(fn)), doc
)
help += "\n\n"
help += textwrap.dedent("""