Pinecone Connector - Complete Implementation
All Phases Complete: 1, 2, and 3
Project Overview
A fully functional DataHub connector for Pinecone vector database that extracts metadata about indexes, namespaces, and automatically infers schemas from vector metadata.
File Structure
metadata-ingestion/src/datahub/ingestion/source/pinecone/
├── __init__.py # Module initialization
├── config.py # Configuration model
├── pinecone_client.py # Pinecone SDK wrapper
├── pinecone_source.py # Main source implementation
├── report.py # Reporting and statistics
├── schema_inference.py # Schema inference engine (Phase 3)
├── README.md # User documentation
└── skill_docs/
├── PINECONE_CONNECTOR_PLANNING.md
├── PINECONE_CONNECTOR_IMPLEMENTATION.md
└── PINECONE_datahub-connector-pr-review-2026-03-08.md
metadata-ingestion/examples/recipes/
└── pinecone_to_datahub.yml # Example recipe
metadata-ingestion/tests/unit/
└── test_pinecone_source.py # Comprehensive unit tests
Integration:
├── setup.py # Plugin registration + dependencies
└── src/datahub/ingestion/source/common/subtypes.py # Container subtypes
Phase 1: Core Functionality
Features
- Index discovery via Pinecone API
- Index metadata extraction (dimension, metric, type, host, status)
- Container workunits for indexes
- Support for serverless and pod-based indexes
- Index filtering patterns
- Error handling and reporting
Key Components
PineconeConfig- Configuration with API key, filtering, performance settingsPineconeClient.list_indexes()- Discover all indexesPineconeSource._generate_index_container()- Create index containers
Phase 2: Namespace Support
Features
- Namespace discovery using
describe_index_stats() - Namespace containers with parent relationships
- Dataset workunits representing vector collections
- Namespace filtering patterns
- Default namespace handling
- Complete container hierarchy
Key Components
PineconeClient.list_namespaces()- List namespaces with vector countsPineconeSource._generate_namespace_container()- Create namespace containersPineconeSource._generate_namespace_dataset()- Create dataset workunits
Entity Hierarchy
Platform: pinecone
├── Container (Index) - PINECONE_INDEX
│ ├── Properties: dimension, metric, index_type, host, status
│ └── Container (Namespace) - PINECONE_NAMESPACE
│ ├── Properties: vector_count, index_name
│ └── Dataset (Vector Collection)
│ ├── Properties: dimension, metric, vector_count
│ └── Schema: Inferred from metadata (Phase 3)
Phase 3: Schema Inference
Features
- Vector sampling with fallback strategies
- Metadata field discovery
- Type inference (string, number, boolean, array, object)
- Field frequency tracking
- Mixed type handling
- Schema field generation with descriptions
- Configurable sampling size and field limits
Key Components
1. Schema Inference Engine (schema_inference.py)
class MetadataSchemaInferrer:
- infer_schema() - Main inference method
- _collect_field_statistics() - Gather field stats
- _infer_field_type() - Detect field types
- _select_primary_type() - Handle mixed types
- _generate_schema_fields() - Create SchemaField objects
2. Enhanced Vector Sampling (pinecone_client.py)
- sample_vectors() - Main sampling method with fallbacks
- _list_vector_ids() - List IDs using list() API
- _fetch_vectors() - Fetch with metadata using fetch() API
- _query_sample_vectors() - Fallback using query() API
3. Schema Integration (pinecone_source.py)
- _infer_schema() - Orchestrate schema inference
- Emit SchemaMetadata workunits
- Handle inference failures gracefully
Sampling Strategy
Three-tier fallback:
- Primary:
list()+fetch()(deterministic) - Fallback:
query()with dummy vector - Graceful: Continue without schema if both fail
Type Detection
| Python Type | Inferred Type | DataHub Type |
|---|---|---|
str | string | StringTypeClass |
int, float | number | NumberTypeClass |
bool | boolean | BooleanTypeClass |
list | array | ArrayTypeClass |
dict | object | (StringTypeClass) |
None | null | (StringTypeClass) |
Schema Field Example
SchemaField(
fieldPath="[version=2.0].category",
type=StringTypeClass(),
nativeDataType="string",
description="Appears in 100.0% of vectors. Examples: A, B, C",
nullable=True
)
Configuration
Complete Configuration Example
source:
type: pinecone
config:
api_key: "${PINECONE_API_KEY}"
environment: "us-west1-gcp"
platform_instance: "production"
env: "PROD"
index_pattern:
allow:
- "prod-.*"
- "customer-.*"
deny:
- ".*-test"
- ".*-dev"
namespace_pattern:
allow:
- "customer-.*"
deny:
- "internal-.*"
enable_schema_inference: true
schema_sampling_size: 100
max_metadata_fields: 100
max_workers: 5
stateful_ingestion:
enabled: true
remove_stale_metadata: true
sink:
type: datahub-rest
config:
server: "http://localhost:8080"
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
api_key | string | Required | Pinecone API key |
environment | string | None | For pod-based indexes |
index_pattern | AllowDenyPattern | Allow all | Filter indexes |
namespace_pattern | AllowDenyPattern | Allow all | Filter namespaces |
enable_schema_inference | boolean | true | Enable schema inference |
schema_sampling_size | int | 100 | Vectors to sample |
max_metadata_fields | int | 100 | Max schema fields |
max_workers | int | 5 | Parallel workers |
platform_instance | string | None | Platform instance ID |
env | string | "PROD" | Environment |
stateful_ingestion | object | None | Stateful config |
Testing
Unit Tests
Test Coverage:
- Configuration validation
- Client initialization
- Index listing and filtering
- Namespace discovery
- Schema inference engine
- Type detection
- Mixed type handling
- Workunit generation
- Error handling
Run Tests:
pytest tests/unit/test_pinecone_source.py -v
Test Classes:
TestPineconeConfig- Configuration testsTestPineconeClient- Client wrapper testsTestPineconeSource- Source integration testsTestMetadataSchemaInferrer- Schema inference testsTestPineconeSourceWithSchemaInference- End-to-end tests
Manual Testing
export PINECONE_API_KEY="your-api-key"
datahub ingest -c examples/recipes/pinecone_to_datahub.yml
Capabilities
| Capability | Status | Description |
|---|---|---|
| Platform Instance | Yes | Multi-environment support |
| Containers | Yes | Index and namespace hierarchy |
| Schema Metadata | Yes | Inferred from vector metadata |
| Deletion Detection | Yes | Via stateful ingestion |
| Data Profiling | No | Not applicable |
| Usage Stats | No | Not available from API |
| Lineage | No | Future enhancement |
Performance
Ingestion Speed
| Scenario | Time | Notes |
|---|---|---|
| 1 index, 1 namespace | ~5-10 sec | Including schema inference |
| 10 indexes, 50 namespaces | ~2-5 min | Parallel processing |
| 100 indexes, 500 namespaces | ~20-30 min | May hit rate limits |
Schema Inference Impact
| Sampling Size | Time per Namespace | Accuracy |
|---|---|---|
| 50 | ~1-2 sec | Good |
| 100 (default) | ~2-3 sec | Better |
| 200 | ~4-5 sec | Best |
Dependencies
Python Packages
# setup.py
"pinecone": {"pinecone-client>=3.0.0,<6.0.0"}
Compatibility
- Pinecone SDK: 3.0+
- Python: 3.8+
- Index Types: Serverless and Pod-based
- DataHub: Current version
Future Enhancements (Phase 4+)
- Nested Field Support - Extract nested object fields, support dot notation
- Array Element Types - Infer types of array elements
- Field Statistics - Min/max for numbers, string length stats
- Performance Optimizations - Parallel namespace processing, caching
- Advanced Type Detection - Date/timestamp, URL/email, enum detection
- Usage Statistics - Query patterns, access logs
- Lineage - Connect to embedding models, track data sources
Support
For issues or questions:
Status: Production Ready | Version: 1.0.0 | Last Updated: 2026
Is this page helpful?