Commit 324c963
authored
Remove SDK Defaults for Namespace Parameter (#546)
## Summary
Removes SDK-imposed default values for the `namespace` parameter in GRPC
methods, ensuring the SDK doesn't override API defaults. This change
allows the API to handle namespace defaults appropriately as it moves
toward `"__default__"` as the default namespace value.
## Changes
### GRPC Method Updates
- Updated `pinecone/grpc/resources/vector_grpc.py`: Changed
`upsert_from_dataframe` method signature from `namespace: str = ""` to
`namespace: Optional[str] = None`
- Updated `pinecone/grpc/index_grpc.py`: Changed `upsert_from_dataframe`
method signature from `namespace: str = ""` to `namespace: Optional[str]
= None`
### Behavior Verification
- All REST API methods already correctly use `Optional[str] = None` for
namespace parameters
- When `namespace=None`: Parameter is omitted from request bodies (via
`parse_non_empty_args`), allowing the API to apply its default
- When `namespace=""`: Parameter is included as empty string in request
(explicit user choice, passed through unmodified)
- When `namespace="some_namespace"`: Parameter is included in request as
expected
## Impact
- **GRPC `upsert_from_dataframe` methods**: Now default to `None`
instead of `""`, allowing the API to handle namespace defaults
- **Backward compatibility**: No breaking changes - methods still accept
all the same values, but default behavior now defers to the API
- **API flexibility**: The API can now apply its own default namespace
handling (e.g., `"__default__"`) without SDK interference
## Rationale
The API is moving toward `"__default__"` as the default namespace value.
By removing SDK-imposed defaults (empty string), we ensure:
- The SDK doesn't override API defaults
- When users don't specify a namespace, the API can apply its own
default handling
- Explicit empty string values from users are still passed through as
intended
- The SDK remains neutral regarding namespace defaults, allowing the API
to evolve its default behavior
## Testing
- All db data integration tests pass (104 passed, 18 skipped)
- Verified that `namespace=None` omits the parameter from requests
- Verified that `namespace=""` passes through as empty string
- Verified that explicit namespace values work correctly
## Files Changed
- `pinecone/grpc/resources/vector_grpc.py`
- `pinecone/grpc/index_grpc.py`1 parent c6392fa commit 324c963
2 files changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
0 commit comments