When a table has an index on a column and you rename that column via transform(rename=...), a TransformError is raised even though the column still exists under its new name.
import sqlite_utils
db = sqlite_utils.Database(memory=True)
db["t"].insert({"id": 1, "name": "Alice"}, pk="id")
db["t"].create_index(["name"])
db["t"].transform(rename={"name": "full_name"})
# TransformError: Index 'idx_t_name' column 'name' is not in updated table 't'.
The error says the column "is not in updated table", but a renamed column is by definition still present. The check in _transform_sql() conflates col in rename (column still exists, just renamed) with col in drop (column truly removed). Only dropped columns make an index unrecoverable; renamed columns can have their index recreated using the new name.
When a table has an index on a column and you rename that column via
transform(rename=...), aTransformErroris raised even though the column still exists under its new name.The error says the column "is not in updated table", but a renamed column is by definition still present. The check in
_transform_sql()conflatescol in rename(column still exists, just renamed) withcol in drop(column truly removed). Only dropped columns make an index unrecoverable; renamed columns can have their index recreated using the new name.