simonw / sqlite-utils

Python CLI utility and library for manipulating SQLite databases
https://sqlite-utils.datasette.io
Apache License 2.0
1.63k stars 111 forks source link

fix: enable-fts permanently save triggers #498

Closed chapmanjacobd closed 1 year ago

chapmanjacobd commented 1 year ago

I was wondering why my all my databases were giving wild search results. Turns out create_trigger was not sticking!

Running sqlite-utils triggers x.db shows [] after running enable-fts using the python api. Looking at the counts trigger it seems that is the right way to save triggers. triggers show up now


:books: Documentation preview :books:: https://sqlite-utils--498.org.readthedocs.build/en/498/

codecov[bot] commented 1 year ago

Codecov Report

Base: 96.37% // Head: 96.37% // Increases project coverage by +0.00% :tada:

Coverage data is based on head (75577e5) compared to base (d792dad). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #498 +/- ## ======================================= Coverage 96.37% 96.37% ======================================= Files 4 4 Lines 2401 2402 +1 ======================================= + Hits 2314 2315 +1 Misses 87 87 ``` | [Impacted Files](https://codecov.io/gh/simonw/sqlite-utils/pull/498?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison) | Coverage Δ | | |---|---|---| | [sqlite\_utils/db.py](https://codecov.io/gh/simonw/sqlite-utils/pull/498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison#diff-c3FsaXRlX3V0aWxzL2RiLnB5) | `97.32% <100.00%> (+<0.01%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Simon+Willison)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

chapmanjacobd commented 1 year ago

nevermind it was because I was running db[table].transform. The fts tables would still be there but the triggers would be dropped