Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite3.IntegrityError when syncing tmpo #38

Open
kdebrab opened this issue Jan 15, 2018 · 0 comments
Open

sqlite3.IntegrityError when syncing tmpo #38

kdebrab opened this issue Jan 15, 2018 · 0 comments

Comments

@kdebrab
Copy link
Contributor

kdebrab commented Jan 15, 2018

The first time I run below code (tmpo.sqlit3 does not exist yet), it works.

But when I run it a second time (thus when tmpo.sqlite3 already exists), it fails with the following error:

In[2]: from opengrid_dev.library import houseprint
  ...: hp = houseprint.Houseprint()
  ...: hp.sync_tmpos()
Backend TkAgg is interactive backend. Turning interactive mode on.
Opening connection to Houseprint sheet
Opening spreadsheets
Parsing spreadsheets
35 Sites created
36 Devices created
102 sensors created
Houseprint parsing complete

  0%|          | 0/102 [00:00<?, ?it/s]Using tmpo database from C:\Users\kdb\tmpo\tmpo.sqlite3

  1%|          | 1/102 [00:00<00:16,  6.22it/s]
Traceback (most recent call last):
  File "C:\GitLab\opengrid_dev\venv\lib\site-packages\IPython\core\interactiveshell.py", line 2910, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-e58e45ca9dc8>", line 4, in <module>
    hp.sync_tmpos()
  File "C:\GitLab\opengrid_dev\opengrid_dev\library\houseprint\houseprint.py", line 489, in sync_tmpos
    tmpos.sync(sensor.key)
  File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 165, in wrapper
    raise e
  File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 157, in wrapper
    result = func(*args, **kwargs)
  File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 277, in sync
    self._req_sync(sid, rid, lvl, bid)
  File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 553, in _req_sync
    f.result(), sid, t["rid"], t["lvl"], t["bid"], t["ext"])
  File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 569, 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.bid```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant