Commit 44fc7ed
authored
Simplify passing host configuration direct to Index client (#280)
## 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
```python
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
```python
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
- [x] 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.1 parent 557afd5 commit 44fc7ed
File tree
3 files changed
+65
-11
lines changed- pinecone
- control
- grpc
- tests/integration/data
3 files changed
+65
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments