Skip to main content

Clear a store

Delete every entry from a store without deleting the store itself.

This operation works on both Vector DB stores and AI stores. Use the Database engine / AI proxy switch in the sample below.

Parameters

ParameterTypeDescription
storestringName of the store to clear.
schemastring · optionalSchema containing the store. Defaults to public.

Behavior

  • Deletes every entry and returns the number removed.
  • Preserves the store, its creation information, dimension, predicate indexes, and non-linear index configuration.
  • Returns deleted_count: 0 when the store is already empty.
warning

Clearing a store permanently deletes its entries. This operation cannot be undone.

ClearStore compared with DropStore

OperationEntriesStore configuration
ClearStoreDeletedPreserved
DropStoreDeletedDeleted

Sample query

Python
import asyncio
from grpclib.client import Channel
from ahnlich_client_py.grpc.db import query as db_query
from ahnlich_client_py.grpc.services.db_service import DbServiceStub


async def clear_store():
async with Channel(host="127.0.0.1", port=1369) as channel:
client = DbServiceStub(channel)
response = await client.clear_store(
db_query.ClearStore(store="movies", schema="public")
)
print(f"Deleted {response.deleted_count} entries")


asyncio.run(clear_store())

Response

The response contains deleted_count, the number of entries removed.

Use ClearStore when the store should remain available for new entries. Use DropStore when the store and its configuration are no longer needed.