Skip to content

Commit 324c963

Browse files
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

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pinecone/grpc/index_grpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def _upsert_batch(
236236
def upsert_from_dataframe(
237237
self,
238238
df: Any,
239-
namespace: str = "",
239+
namespace: str | None = None,
240240
batch_size: int = 500,
241241
use_async_requests: bool = True,
242242
show_progress: bool = True,

pinecone/grpc/resources/vector_grpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def _upsert_batch(
174174
def upsert_from_dataframe(
175175
self,
176176
df,
177-
namespace: str = "",
177+
namespace: Optional[str] = None,
178178
batch_size: int = 500,
179179
use_async_requests: bool = True,
180180
show_progress: bool = True,

0 commit comments

Comments
 (0)