Getting Started with Pinecone
Create a Pinecone index, upsert vectors with metadata, perform similarity queries with filters, and manage namespaces to separate different data collections.
What Is Pinecone?
Pinecone is a fully managed vector database that handles infrastructure, scaling, and backups automatically. You interact with it through a Python SDK, sending vectors and metadata via API calls. Pinecone stores them on its servers and answers similarity queries at low latency, even at billions of vectors.
It offers a free tier that is sufficient for learning and small production workloads.
Installing the Pinecone SDK
Install the Pinecone client and initialize it with your API key. Store the API key in an environment variable — never hardcode secrets in source files. The Pinecone class is the main entry point for all operations.
# pip install pinecone-client
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ['PINECONE_API_KEY'])
# List existing indexes to verify connection
existing = pc.list_indexes().names()
print('Existing indexes:', existing)All lessons in this course
- Why You Need a Vector Database
- Getting Started with Pinecone
- pgvector: Embeddings in PostgreSQL
- Choosing and Benchmarking Vector Stores