sqlite-utils convert db table column -, refs #353

This commit is contained in:
Simon Willison 2021-12-10 16:01:02 -08:00
commit a3df483c80
3 changed files with 48 additions and 0 deletions

View file

@ -1023,6 +1023,16 @@ You can specify Python modules that should be imported and made available to you
'"\n".join(textwrap.wrap(value, 100))' \
--import=textwrap
Use a CODE value of `-` to read from standard input:
$ cat mycode.py | sqlite-utils convert content.db articles headline -
Where `mycode.py` contains a fragment of Python code that looks like this:
```python
return value.upper()
```
The transformation will be applied to every row in the specified table. You can limit that to just rows that match a ``WHERE`` clause using ``--where``::
$ sqlite-utils convert content.db articles headline 'value.upper()' \