-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Sometimes I run into this error while syncing a sensor:
File "D:\Python34\lib\site-packages\tmpo\__init__.py", line 253, in sync
self._req_sync(sid, rid, lvl, bid)
File "D:\Python34\lib\site-packages\tmpo\__init__.py", line 530, in _req_sync
f.result(), sid, t["rid"], t["lvl"], t["bid"], t["ext"])
File "D:\Python34\lib\site-packages\tmpo\__init__.py", line 546, in _write_block
self.dbcur.execute(SQL_TMPO_INS, (sid, rid, lvl, bid, ext, now, blk))
sqlite3.IntegrityError: UNIQUE constraint failed: tmpo.sid, tmpo.rid, tmpo.lvl, tmpo.bidMy current solution is to just delete all TMPO-blocks for that sensor (see #27, implementation is on the way), after which I re-add the sensor and sync again. This causes a little bit of overhead, but it works fine.
However: doesn't this error just mean that the block we're trying to write already exists in the database? So we could deal with it in two ways:
- Assume the correct block is already written, so we can just ignore this insert.
- Assume the new block might be better, so overwrite the old one.
@icarus75 what do you think?
Metadata
Metadata
Assignees
Labels
No labels