Skip to main content

namespaces.delete

Permanently deletes a namespace and all its contents. This action is irreversible.

Parameters

namespace_name
str
required
The exact name of the namespace to delete.
Returns: None. Raises: NamespaceNotFound, AuthenticationError, APIError.

Example

Delete Namespace Example
from moorcheh_sdk import MoorchehClient, NamespaceNotFound

with MoorchehClient() as client:
    try:
        client.namespaces.delete(namespace_name="my-temporary-namespace")
        print("Namespace deleted successfully")
    except NamespaceNotFound:
        print("Namespace was not found")

Error Handling

Error Handling Example
from moorcheh_sdk import MoorchehClient, NamespaceNotFound, APIError

with MoorchehClient() as client:
    namespace_to_delete = "my-old-namespace"
    
    try:
        client.namespaces.delete(namespace_to_delete)
        print(f"Successfully deleted namespace: {namespace_to_delete}")
    except NamespaceNotFound:
        print(f"Namespace '{namespace_to_delete}' does not exist")
    except APIError as e:
        print(f"API error occurred: {e}")
Deleting a namespace permanently removes all data within it. This action cannot be undone.

Important Notes

  • Deletion is processed asynchronously and may take several minutes for large namespaces
  • You can continue using other namespaces while deletion is in progress
  • Storage quota is updated once deletion is complete
  • Deleted namespace names become available for reuse after completion

Best Practices

  • Backup Important Data: Export or backup critical data before deletion
  • Verify Namespace Name: Double-check the namespace name before deletion
  • Monitor Usage: Use the list namespaces endpoint to confirm deletion completion
  • Plan Downtime: Consider impact on applications using the namespace

Use Cases

  • Data Cleanup: Remove old or unused namespaces to free up storage
  • Project Completion: Delete namespaces for completed projects
  • Resource Management: Manage namespace limits by removing unused ones
  • Data Lifecycle: Implement data retention policies