From dcdef136dbe05ecbd156e99688d2a938f307a581 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 22 Sep 2020 17:31:15 -0700 Subject: [PATCH] Release 2.20 Refs #114, #42, #162, #164, #165, #167, #169. Closes #170 --- docs/changelog.rst | 29 +++++++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9a2ab44..0051480 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,35 @@ Changelog =========== +.. _v2_20: + +2.20 (2020-09-22) +----------------- + +This release introduces two key new capabilities: **transform** (`#114 `__) and **extract** (`#42 `__). + +Transform +~~~~~~~~~ + +SQLite's ALTER TABLE has `several documented limitations `__. The ``table.transform()`` Python method and ``sqlite-utils transform`` CLI command work around these limitations using a pattern where a new table with the desired structure is created, data is copied over to it and the old table is then dropped and replaced by the new one. + +You can use these tools to drop columns, change column types, rename columns, add and remove ``NOT NULL`` and defaults, remove foreign key constraints and more. See the :ref:`transforming tables (CLI) ` and :ref:`transforming tables (Python library) ` documentation for full details of how to use them. + +Extract +~~~~~~~ + +Sometimes a database table - especially one imported from a CSV file - will contain duplicate data. A ``Trees`` table may include a ``Species`` column with only a few dozen unique values, when the table itself contains thousands of rows. + +The ``table.extract()`` method and ``sqlite-utils extract`` commands can extract a column - or multiple columns - out into a separate lookup table, and set up a foreign key relationship from the original table. + +The Python library :ref:`extract() documentation ` describes how extraction works in detail, and :ref:`cli_extract` in the CLI documentation includes a detailed example. + +Other changes +~~~~~~~~~~~~~ + +- The ``@db.register_function`` decorator can be used to quickly register Python functions as custom SQL functions, see :ref;`python_api_register_function`. (`#162 `__) +- The ``table.rows_where()`` method now accepts an optional ``select=`` argument for specifying which columns should be selected, see :ref:`python_api_rows`. + .. _v2_19: 2.19 (2020-09-20) diff --git a/setup.py b/setup.py index ccaf564..7e3d792 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import io import os -VERSION = "2.19" +VERSION = "2.20" def get_long_description():