Skip to content

sqlite-utils 4.0a1 enable_fts(replace=True): sqlite3.OperationalError: table "{}_fts" already exists #694

@chapmanjacobd

Description

@chapmanjacobd

I've been playing around with the sqlite-utils v4 beta and everything seems to mostly work but there seems to be different behavior with enable_fts() compared to v3.39.

### https://github.com/chapmanjacobd/library/blob/849349db7c27aae54afde234cf3e734fb41c85e5/library/utils/db_utils.py#L217
                db[table].enable_fts(
                    fts_columns,
                    create_triggers=True,
                    replace=True,
                    tokenize=(
                        "trigram" if sqlite3.sqlite_version_info >= (3, 34, 0) else 'unicode61 "tokenchars=_."'
                    ),  # https://www.sqlite.org/releaselog/3_34_0.html
                )

This code runs fine on 3.39 but in 4.0a1 I get an error like this:

  File "/home/xk/.local/lib/python3.14/site-packages/sqlite_utils/db.py", line 2567, in enable_fts
    self.db.executescript(create_fts_sql)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/xk/.local/lib/python3.14/site-packages/sqlite_utils/db.py", line 561, in executescript
    return self.conn.executescript(sql)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
sqlite3.OperationalError: table "playlists_fts" already exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions