sanatan_ai / modules /db /delete_collection.py
vikramvasudevan's picture
Upload folder using huggingface_hub
7217024 verified
import chromadb
# Path where your Chroma DB is stored
CHROMA_PATH = "chromadb-store"
COLLECTION_NAME = "vishnu_sahasranamam"
# Initialize Chroma client
client = chromadb.PersistentClient(path=CHROMA_PATH)
# Check and delete the collection if it exists
collections = [c.name for c in client.list_collections()]
if COLLECTION_NAME in collections:
client.delete_collection(name=COLLECTION_NAME)
print(f"✅ Deleted collection '{COLLECTION_NAME}' from {CHROMA_PATH}")
else:
print(f"⚠️ Collection '{COLLECTION_NAME}' not found in {CHROMA_PATH}")