For a use case I need a feature like this.
User has his own pinecone index.
He creates a document collection ( a document collection in pinecone can be represented by a namespace , but Pinecone doesn’t allow me to create an empty namespace ).
Is there any workaround for this ?
I really need a feature like this in my app.
Hi, you can create a namespace by upserting a dummy vector, which it seems you may already have figured out Implement multitenancy using namespaces - Pinecone Docs.
Here’s the example from the documentation showing how to create a namespace with minimal data:
python
from pinecone.grpc import PineconeGRPC as Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
index = pc.Index("multitenant-app")
index.upsert( vectors=[ {"id": "A", "values": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]}, ], namespace="tenant1")
After creating the namespace with a dummy vector, you can later delete that vector while keeping the namespace. This is a common workaround for creating what appears to be an “empty” namespace.
As an alternative approach, you could also consider using metadata filtering instead of namespaces if you need more flexibility in how you query the data later
Metadata filtering provides similar performance but allows you to query across multiple collections if needed in the future.