forked from pinecone-io/pinecone-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup-all.py
More file actions
25 lines (20 loc) · 712 Bytes
/
cleanup-all.py
File metadata and controls
25 lines (20 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
from pinecone import Pinecone
def main():
pc = Pinecone(api_key=os.environ.get('PINECONE_API_KEY', None))
for collection in pc.list_collections().names():
try:
print('Deleting collection: ' + collection)
pc.delete_collection(collection)
except Exception as e:
print('Failed to delete collection: ' + collection + ' ' + str(e))
pass
for index in pc.list_indexes().names():
try:
print('Deleting index: ' + index)
pc.delete_index(index)
except Exception as e:
print('Failed to delete index: ' + index + ' ' + str(e))
pass
if __name__ == '__main__':
main()