Skip to content

Commit

Permalink
confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
hbertrand committed Oct 25, 2023
1 parent e0d16c5 commit 3ca4e5c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions buster/documents_manager/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ def drop_db(self):
For Pinecone, this means deleting everything in the namespace.
For Mongo DB, this means dropping the database. However this needs to be done manually through the GUI.
"""
self.index.delete(namespace=self.namespace, delete_all=True)
confirmation = input("Dropping the database is irreversible. Are you sure you want to proceed? (Y/n): ")

logging.info(f"Deleted all documents from Pinecone namespace: {self.namespace=}")
logging.info(f"The MongoDB database needs to be dropped manually: {self.mongo_db_name=}")
if confirmation.strip().lower() == "y":
self.index.delete(namespace=self.namespace, delete_all=True)

logging.info(f"Deleted all documents from Pinecone namespace: {self.namespace=}")
logging.info(f"The MongoDB database needs to be dropped manually: {self.mongo_db_name=}")
else:
logging.info("Operation cancelled.")

0 comments on commit 3ca4e5c

Please sign in to comment.