Skip to content

Commit

Permalink
only for service
Browse files Browse the repository at this point in the history
  • Loading branch information
hbertrand committed Oct 25, 2023
1 parent 0725b45 commit e0d16c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
5 changes: 0 additions & 5 deletions buster/documents_manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,3 @@ def _add_documents(self, df: pd.DataFrame, **add_kwargs):
This method should handle the actual process of adding documents to the database.
"""
...

@abstractmethod
def delete_all(self):
"""Delete all documents from the database."""
...
4 changes: 0 additions & 4 deletions buster/documents_manager/deeplake.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,3 @@ def to_zip(self, output_path: str = "."):
zip_file_path = zip_contents(input_path=vector_store_path, output_path=output_path)
logger.info(f"Compressed {vector_store_path} to {zip_file_path}.")
return zip_file_path

def delete_all(self):
"""Delete all documents from the database."""
raise NotImplementedError()
8 changes: 6 additions & 2 deletions buster/documents_manager/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ def delete_source(self, source: str) -> tuple[int, int]:

return source_deleted, documents_deleted

def delete_all(self):
"""Delete all documents from the database."""
def drop_db(self):
"""Drop the currently accessible database.
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)

logging.info(f"Deleted all documents from Pinecone namespace: {self.namespace=}")
Expand Down

0 comments on commit e0d16c5

Please sign in to comment.