v1.0.178: zip_source — БД, Python, JS. Дедупликация по паре (zip_source, name). addZipFile передаёт имя архива.
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
from .connection import query, execute, execute_returning
|
||||
|
||||
|
||||
def insert(filename, mime_type, original_bytes, status="uploaded", batch_id=None):
|
||||
def insert(filename, mime_type, original_bytes, status="uploaded", batch_id=None, zip_source=None):
|
||||
"""Insert document, return row dict."""
|
||||
return execute_returning(
|
||||
"""INSERT INTO documents (filename, mime_type, original_bytes, status, batch_id)
|
||||
VALUES (%s, %s, %s, %s, %s) RETURNING *""",
|
||||
(filename, mime_type, original_bytes, status, batch_id),
|
||||
"""INSERT INTO documents (filename, mime_type, original_bytes, status, batch_id, zip_source)
|
||||
VALUES (%s, %s, %s, %s, %s, %s) RETURNING *""",
|
||||
(filename, mime_type, original_bytes, status, batch_id, zip_source),
|
||||
)
|
||||
|
||||
|
||||
@@ -73,7 +73,8 @@ def list_by_batch(batch_id):
|
||||
"""All documents in a batch with classification fields."""
|
||||
return query(
|
||||
"""SELECT id, filename, status, doc_type, own_number, parent_number,
|
||||
doc_date, counterparty, classify_status, error_message, classify_raw, classify_input
|
||||
doc_date, counterparty, classify_status, error_message, classify_raw, classify_input,
|
||||
zip_source
|
||||
FROM documents WHERE batch_id=%s ORDER BY created_at""",
|
||||
(batch_id,),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user