瀏覽代碼

Deduplicate items

tags/v0.2.0
JustAnotherArchivist 4 年之前
父節點
當前提交
5008e6e8cd
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. +2
    -1
      qwarc/__init__.py

+ 2
- 1
qwarc/__init__.py 查看文件

@@ -222,7 +222,7 @@ class QWARC:
values = [(t, v, STATUS_TODO) for t, v in itertools.islice(it, 100000)]
if not values:
break
cursor.executemany('INSERT INTO items (type, value, status) VALUES (?, ?, ?)', values)
cursor.executemany('INSERT OR IGNORE INTO items (type, value, status) VALUES (?, ?, ?)', values)
cursor.execute('COMMIT')
except:
cursor.execute('ROLLBACK')
@@ -316,6 +316,7 @@ class QWARC:
with db:
db.execute('CREATE TABLE items (id INTEGER PRIMARY KEY, type TEXT, value TEXT, status INTEGER)')
db.execute('CREATE INDEX items_status_idx ON items (status)')
db.execute('CREATE UNIQUE INDEX items_type_value_idx ON items (type, value)')

it = itertools.chain(*(i._gen() for i in self._itemClasses))
while True:


Loading…
取消
儲存