Skip to content

Commit

Permalink
Fix null document ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Aug 31, 2023
1 parent f316c85 commit 5dc855c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backend/danswer/db/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def upsert_documents(
if doc_id not in seen_documents:
seen_documents[doc_id] = document_metadata

if not seen_documents:
logger.info("No documents to upsert. Skipping.")
return

insert_stmt = insert(DbDocument).values(
[
model_to_dict(
Expand All @@ -113,6 +117,10 @@ def upsert_document_by_connector_credential_pair(
db_session: Session, document_metadata_batch: list[DocumentMetadata]
) -> None:
"""NOTE: this function is Postgres specific. Not all DBs support the ON CONFLICT clause."""
if not document_metadata_batch:
logger.info("`document_metadata_batch` is empty. Skipping.")
return

insert_stmt = insert(DocumentByConnectorCredentialPair).values(
[
model_to_dict(
Expand Down

1 comment on commit 5dc855c

@vercel
Copy link

@vercel vercel bot commented on 5dc855c Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.