Skip to content

Add support for list, describe, and delete namespaces in grpc #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 27, 2025

Conversation

rohanshah18
Copy link
Contributor

@rohanshah18 rohanshah18 commented Jun 26, 2025

Problem

Support for REST sync and async namespaces was added in a previous PR, so this PR adds support for gRPC only.

Solution

Add support for list, describe, and delete namespaces in grpc.

from pinecone.grpc import PineconeGRPC as Pinecone

# Initialize Pinecone client
pc = Pinecone(api_key='your-api-key')

# Get index
index = pc.Index('your-index-name')

# Example: List all namespaces (automatic pagination)
print("All namespaces:")
for namespace in index.list_namespaces():
    print(f"{namespace.name}: {namespace.record_count} records")

# Example: List namespaces with pagination control
results = index.list_namespaces_paginated(limit=10)
print(f"First 10 namespaces:")
for namespace in results.namespaces:
    print(f"{namespace.name}: {namespace.record_count} records")

# Example: Describe a specific namespace
namespace_info = index.describe_namespace(namespace='my-namespace')
print(f"Namespace '{namespace_info.name}' has {namespace_info.record_count} records")

# Example: Delete a namespace (irreversible!)
index.delete_namespace(namespace='namespace-to-delete')

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Added integration and unit tests

@rohanshah18 rohanshah18 changed the title Add support for grpc namespaces Add support for list, describe, and delete namespaces in grpc Jun 26, 2025
@rohanshah18 rohanshah18 marked this pull request as ready for review June 26, 2025 18:45
Copy link
Contributor

@austin-denoble austin-denoble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, the one thing I noticed is we should probably delete the old 2025-01 grpc files since they're no longer being used, and I think we used to do this in the past:

  • db_data_2025_01_pb2_grpc.py
  • db_data_2025_01_pb2.py
  • db_data_2025_01_pb2.pyi

# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: db_data_2025-04.proto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I didn't realize the proto files weren't also generated for the v7 release initially. Do the 2025_01 files need to be removed as well? Currently, 2025-01 and 2025-04 are present and I don't think that's correct:
Screenshot 2025-06-27 at 11 07 01 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't have much context here on whether we delete the older versions or not, but it definitely feels weird not deleting 2025_01. In the future, I'd like to add the following steps to build-grpc.sh:

  1. Before code generation: Delete old proto files.
  2. After code generation: Either
    • Update all yyyy-mm references in the codebase so we don’t have to manually edit the imports, or
    • Rename the proto files to remove yyyy-mm, so no edits are required in the codebase.

@rohanshah18 rohanshah18 merged commit 64ca705 into main Jun 27, 2025
37 checks passed
@rohanshah18 rohanshah18 deleted the rshah/namespaces-grpc branch June 27, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants