weird error
"marinus van aswegen" <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Hi all
I'm new to pysqlite and my app broke this morning after running for
quite a while.
I've googled the error but I could not find any advise. My app grabs
new data (into a import table) does a delta against the store
(statements) and
then insert the delta. Everything worked until this morning. Can
anyone explain whats happening?
Traceback (most recent call last):
File "c:\Development\Telic Dashboard\fetch2.py", line 205, in ?
cursor.execute("insert into statements \
pysqlite2.dbapi2.IntegrityError: PRIMARY KEY must be unique
the code in question is
cursor.execute("insert into statements \
SELECT null,import.account, import.date, import.n1, import.n2,
import.value, null, null\
FROM import LEFT OUTER JOIN statements ON \
(import.date = statements.date AND import.value=statements.value AND
import.account = statements.account)\
WHERE statements.id IS null")
table schema's
cursor.execute('CREATE TABLE statements (id INTEGER PRIMARY KEY,
account VARCHAR(20), date timestamp, n1 VARCHAR(20),\
n2 VARCHAR(20), value decimal, action VARCHAR(20), bucket VARCHAR(20))')
cursor.execute('CREATE TABLE import (id INTEGER PRIMARY KEY, account
VARCHAR(20), date timestamp, n1 VARCHAR(20),\
n2 VARCHAR(20), value decimal)')
regards
Marinus