simonw / simonw/sqlite-utils

Clarify transform() behavior for indexes, views and triggers

Open Beginner friendly
#849 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.2k
Forks
172
Avg merge
9m
Merged PRs (30d)
1

Description

The documentation for transform_sql() appears to be slightly out of date.

In the “Custom transformations with .transform_sql()” section, it currently says:

The .transform() method can handle most cases, but it does not automatically upgrade indexes, views or triggers associated with the table that is being transformed.

That is now misleading for indexes and views:

  • Indexes on renamed columns are recreated using the new column name.
  • Tables referenced by views can be transformed safely.
  • View definitions are kept unchanged and continue to point to the live table.
  • Triggers are not automatically updated, so that part of the warning is still useful.

I verified this against the current main branch with a table containing an index and a dependent view. After renaming a column with transform(rename=...), the index was recreated against the new column name and the view remained unchanged and queryable when it only referenced an unaffected column.

Could this paragraph be updated to clarify the current behavior? For example:

The .transform() method preserves and recreates indexes where possible, and tables referenced by views can be transformed without repointing those views. View definitions and triggers are not automatically rewritten when their referenced columns change, so those definitions may need to be updated manually.

The existing “Tables referenced by views” section already documents much of this behavior, so this would mainly remove the contradiction between the two sections.

References:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in docs/python-api.rst at the “Custom transformations with .transform_sql()” section, then compare it with the existing “Tables referenced by views” section. Update the contradictory paragraph so it accurately distinguishes index recreation, safe transformations of tables referenced by views, unchanged view definitions, and triggers requiring manual updates; done when the two sections no longer conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
92/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.