myemperor/longan-sqlite3

执行test.py出错

Closed this issue · 2 comments

python3 test.py

[Longan Debug] CREATE TABLE IF NOT EXISTS COMPANY(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
age INT NOT NULL,
address CHAR(50),
salary REAL
);
[Longan Debug] INSERT OR IGNORE INTO company (name,age,address,salary) VALUES('jobs', 50, 'America', 90)
[Longan Debug] PRAGMA TABLE_INFO(company)
Traceback (most recent call last):
File "test.py", line 21, in
longan.insert_or_update(*flesh_list)
File "/mnt/e/cygwin64/home/an/git/longan-sqlite3/longan_sqlite/longan.py", line 119, in insert_or_update
where = "{}={}".format(key, add_quotes(obj.get(key)))
File "/mnt/e/cygwin64/home/an/git/longan-sqlite3/longan_sqlite/flesh.py", line 14, in get
return self.dict[name]
KeyError: 'id'

你们自己的测试代码都跑不通。

非常抱歉,已经修复。

已更新后,能正常执行了。现在在使用中,非常方便。最喜欢这种轻量,使用方便的库了。