From 723ee35344fa9f5e49dca578170cc5f5eb7223ce Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 2 Aug 2021 14:18:01 -0700 Subject: [PATCH] Release 3.14 Refs #251, #301, #302, #303, #304, #305 --- docs/changelog.rst | 29 +++++++++++++++++++++++++++++ docs/cli.rst | 4 ++-- setup.py | 2 +- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9d17c1e..d9a125d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,35 @@ Changelog =========== +.. _v3_14: + +3.14 (2021-08-02) +----------------- + +This release introduces the new :ref:`sqlite-utils convert command ` (`#251 `__) and corresponding :ref:`table.convert(...) ` Python method (`#302 `__). These tools can be used to apply a Python conversion function to one or more columns of a table, either updating the column in place or using transformed data from that column to populate one or more other columns. + +This command-line example uses the Python standard library `textwrap module `__ to wrap the content of the ``content`` column in the ``articles`` table to 100 characters:: + + $ sqlite-utils convert content.db articles content \ + '"\n".join(textwrap.wrap(value, 100))' \ + --import=textwrap + +The same operation in Python code looks like this: + +.. code-block:: python + + import sqlite_utils, textwrap + + db = sqlite_utils.Database("content.db") + db["articles"].convert("content", lambda v: "\n".join(textwrap.wrap(v, 100))) + +See the full documentation for the :ref:`sqlite-utils convert command ` and the :ref:`table.convert(...) ` Python method for more details. + +Also in this release: + +- The new ``table.count_where(...)`` method, for counting rows in a table that match a specific SQL ``WHERE`` clause. (`#305 `__) +- New ``--silent`` option for the :ref:`sqlite-utils insert-files command ` to hide the terminal progress bar, consistent with the ``--silent`` option for ``sqlite-utils convert``. (`#301 `__) + .. _v3_13: 3.13 (2021-07-24) diff --git a/docs/cli.rst b/docs/cli.rst index 32405c6..3802963 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -939,10 +939,10 @@ The code you provide will be compiled into a function that takes ``value`` as a value = str(value) return value.upper()' -You can specify Python modules that should be imported and made available to your code using one or more ``--import`` options:: +You can specify Python modules that should be imported and made available to your code using one or more ``--import`` options. This example uses the ``textwrap`` module to wrap the ``content`` column at 100 characters:: $ sqlite-utils convert content.db articles content \ - '"\n".join(textwrap.wrap(value, 10))' \ + '"\n".join(textwrap.wrap(value, 100))' \ --import=textwrap 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``:: diff --git a/setup.py b/setup.py index 5009736..8aa9aeb 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import io import os -VERSION = "3.13" +VERSION = "3.14" def get_long_description():