Build

Namespaces

Partition data within a project using logical namespaces for multi-tenant or multi-environment setups.

Overview

Namespaces partition data inside a single project. Use them to separate datasets, tenants, or environments without creating additional projects. Each namespace is an isolated partition — the same document ID can exist in multiple namespaces without colliding.

Usage

namespaces.py
import os
from kyrodb import KyroDBClient

with KyroDBClient(
    target=os.environ["KYRODB_GRPC_ENDPOINT"],
    api_key=os.environ["KYRODB_API_KEY"],
) as client:
    # Insert into the "products" namespace
    client.insert(
        doc_id=1,
        embedding=[0.1, 0.2, 0.3, 0.4],
        metadata={"name": "Widget A"},
        namespace="products",
    )

    # Insert the same ID into a different namespace
    client.insert(
        doc_id=1,
        embedding=[0.4, 0.5, 0.6, 0.7],
        metadata={"ticket": "T-1234"},
        namespace="support",
    )

    # Search only within "products"
    results = client.search(
        query_embedding=[0.1, 0.2, 0.3, 0.4],
        k=5,
        namespace="products",
    )
Default Namespace

If you omit the namespace parameter, all operations use the default namespace automatically.

Common Patterns

Use CaseNamespace Strategy
Multi-tenant SaaSOne namespace per tenant: tenant-123, tenant-456
Environment separationproduction, staging, development
Data categoriesproducts, support-tickets, documentation
A/B testingindex-v1, index-v2

Namespace vs. Project

Choose the right isolation level for your use case:

NeedUse
Logical data separation within one appNamespace
Different embedding dimensionsSeparate project
Different distance metricsSeparate project
Different regionsSeparate project
Separate API key boundarySeparate project

Next Steps

  • Python SDK for the full API reference including namespace parameters on every operation.
  • Projects for when to create new projects vs. namespaces.