From d3cb7dbd24cd291170978f8233250e0a6037b8ed Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sun, 29 Nov 2026 08:45:01 -0800 Subject: [PATCH 1/3] transform(not_null={"col": False}) no longer adds NOT NULL to a nullable column Passing False for a column that was already nullable fell through to the branch that adds the constraint. False now always leaves the column nullable. Co-Authored-By: Claude Fable 5.2 --- sqlite_utils/db.py | 6 +++--- tests/test_transform.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index c011d9bb0..9f3b59701 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -3047,10 +3047,10 @@ def fk_with_renamed_columns(fk: ForeignKey) -> ForeignKey: for key, value in not_null.items(): # Column may have been renamed key = rename.get(key) or key - if value is False and key in create_table_not_null: - create_table_not_null.remove(key) - else: + if value: create_table_not_null.add(key) + else: + create_table_not_null.discard(key) elif isinstance(not_null, set): create_table_not_null.update((rename.get(k) or k) for k in not_null) elif not not_null: diff --git a/tests/test_transform.py b/tests/test_transform.py index 873871308..5c7a4d3ec 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -308,6 +308,22 @@ def test_transform_remove_a_not_null(fresh_db): ) +def test_transform_not_null_false_leaves_nullable_column_nullable(fresh_db): + # not_null={"col": False} on a column that was already nullable + # used to add NOT NULL to it + dogs = fresh_db["dogs"] + dogs.insert({"id": 1, "name": "Cleo", "age": None}, pk="id") + dogs.transform(not_null={"age": False}) + assert dogs.schema == ( + 'CREATE TABLE "dogs" (\n' + ' "id" INTEGER PRIMARY KEY,\n' + ' "name" TEXT,\n' + ' "age" TEXT\n' + ")" + ) + assert list(dogs.rows) == [{"id": 1, "name": "Cleo", "age": None}] + + @pytest.mark.parametrize("not_null", [{"age"}, {"age": True}]) def test_transform_add_not_null_with_rename(fresh_db, not_null): dogs = fresh_db.table("dogs") From 4bdde4ca7fb18f8ab2288d79471066140640eb0b Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sun, 29 Nov 2026 08:48:38 -0800 Subject: [PATCH 2/3] Remove a redundant cast flagged by newer ty Co-Authored-By: Claude Fable 5.2 --- sqlite_utils/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index 9f3b59701..22d9aa008 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -4789,7 +4789,7 @@ def insert_all( raise ValueError( "When using list-based iteration, the first yielded value must be a list of column name strings" ) - column_names = cast(list[str], list(first_record)) + column_names = list(first_record) all_columns = column_names num_columns = len(column_names) # Get the actual first data record From 58898678bed2ddca6a58d190d8c89a5f7c84e6cf Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sun, 29 Nov 2026 09:19:12 -0800 Subject: [PATCH 3/3] Drop retired macos-14 runner from test matrix GitHub no longer provides the macos-14 runner image, so those jobs were cancelled with "configuration 'macos-14-arm64-us-default' is not supported". macos-latest already covers Apple Silicon. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1cb09b53..3a0698bfb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] numpy: [0, 1] - os: [ubuntu-latest, macos-latest, windows-latest, macos-14] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v7 - name: Set up Python ${{ matrix.python-version }}