Skip to content
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

Simplify passing host configuration direct to Index client #280

Merged
merged 5 commits into from
Jan 15, 2024

Conversation

jhamon
Copy link
Collaborator

@jhamon jhamon commented Jan 15, 2024

Problem

In production situations, it's important people be able to configure the client in a way that does not hit the control plane to find out the host url. This was possible, but now that I'm writing docs I realized this is cumbersome because the positional index name arg was still being required even though it wasn't being used in that scenario.

We want it to be easy.

Solution

Before

from pinecone.grpc import PineconeGRPC

pc = PineconeGRPC(api_key="key")

# Targeting by name is easy
index = pc.Index('blah')

# Targeting by host url is awkward
index = pc.Index('required-but-unused-index-name', host='blah-24vnhz6.svc.apw5-4e34-81fa.pinecone.io')

After

from pinecone.grpc import PineconeGRPC

pc = PineconeGRPC(api_key="key")

# This still works
index = pc.Index('blah')

# This now works
index = pc.Index(host='blah-24vnhz6.svc.apw5-4e34-81fa.pinecone.io')

# Or pass both if you really want, but not needed.
index = pc.Index(name='blah', host='blah-24vnhz6.svc.apw5-4e34-81fa.pinecone.io')

Type of Change

  • New feature (non-breaking change which adds functionality)

Test Plan

Update integration tests to check it can still issue data calls without errors no matter how it is configured.

@jhamon jhamon marked this pull request as ready for review January 15, 2024 03:25
Copy link
Contributor

@tdonia tdonia left a comment

Choose a reason for hiding this comment

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

💜

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.

Nice! 🚢

@jhamon jhamon merged commit 44fc7ed into main Jan 15, 2024
64 checks passed
@jhamon jhamon deleted the jhamon/direct-host branch January 15, 2024 03:51
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.

None yet

3 participants