Hi,
When I run recorder.purge service with keep_days parameters set I get following error.
Feb 05 00:32:35 raspberrypi hass[17876]: 2018-02-05 00:32:35 ERROR (Recorder)
[homeassistant.components.recorder.purge] Error vacuuming SQLite: (sqlite3.OperationalError)
cannot VACUUM from within a transaction [SQL: 'VACUUM'] (Background on this error at:
http://sqlalche.me/e/e3q8).
Note: I am on 0.62.1
I found this Recorder.purge service call not working, which seems to be close to my problem, but apparently that got fixed in 0.62 … maybe I am missing something?
I had the exact same problem and after much looking around I think I have the solution. The issue is Python 3.6.0 and SQLite not working well together. The issue has been resolved in a point-version of Python. I upgraded to Python 3.6.4 - the latest stable version and now it seems like the purge is working.
If you are code inclined this is how you update Python
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
tar xf Python-3.6.4.tar.xz
cd Python-3.6.4
./configure
make
sudo make install
I did this and it just worked - no need to do it specifically within the virtual env.
Thanks Tim,
I did an upgrade and run purge service, but the size of db is still 3.5GB (i.e. no change compared to before purge service was run), no info on what happened in logs either:
2018-02-17 10:10:49 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=recorder, service=purge, service_data=keep_days=100, service_call_id=1968149520-9>
2018-02-17 10:13:41 INFO (Recorder) [homeassistant.components.recorder.purge] Vacuuming SQLite to free space
Unless it takes a lot of time to purge db …
UPDATE after 2 hours:
Actually, something is happening as the db shrinked from 3.5GB down to 2GB … happy days. Thanks @Tim_W