List stores
List the stores currently registered on the server — handy for introspection, admin tooling, and debugging.
Every operation works on both Vector DB stores (you supply raw vectors) and AI stores (you supply text or images and Ahnlich AI generates the embeddings for you). Use the Vector DB / AI switch in the sample below.
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | string · optional | Schema to list. When omitted, lists the public schema only (not every schema). |
All requests accept an optional
schemafield. When omitted, the server uses thepublicschema.
Behavior
- Returns each store's name, entry count, size in bytes, and any active non-linear index configuration.
- An empty list means no stores have been created yet.
Sample query
- Database engine
- AI proxy
- Python
- Node.js
- Go
- Rust
- CLI
Python
import asyncio
from grpclib.client import Channel
from ahnlich_client_py.grpc.services.db_service import DbServiceStub
from ahnlich_client_py.grpc.db import query as db_query
async def list_stores():
async with Channel(host="127.0.0.1", port=1369) as channel:
client = DbServiceStub(channel)
tracing_id = "00-80e1afed08e019fc1110464cfa66635c-7a085853722dc6d2-01"
response = await client.list_stores(
db_query.ListStores(schema="analytics"),
metadata={"ahnlich-trace-id": tracing_id}
)
print(f"Stores: {[store.name for store in response.stores]}")
if __name__ == "__main__":
asyncio.run(list_stores())
TypeScript
import { createDbClient } from "ahnlich-client-node";
import { ListStores } from "ahnlich-client-node/grpc/db/query_pb";
async function listStores() {
const client = createDbClient("127.0.0.1:1369");
const response = await client.listStores(new ListStores({ schema: "analytics" }));
// Get store names
console.log(response.stores.map((s) => s.name));
// Iterate over stores with full details
for (const store of response.stores) {
console.log(`Store: ${store.name}`);
console.log(` Dimension: ${store.dimension}`);
console.log(` Entries: ${store.len}`);
console.log(` Size: ${store.sizeInBytes} bytes`);
console.log(` Predicate Indices: ${store.predicateIndices}`);
console.log(` Non-Linear Indices: ${store.nonLinearIndices}`);
}
}
listStores();
Go
package main
import (
"context"
"fmt"
"log"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
dbsvc "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/services/db_service"
dbquery "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/db/query"
)
const ServerAddr = "127.0.0.1:1369"
func stringPtr(value string) *string { return &value }
type ExampleDBClient struct {
conn *grpc.ClientConn
client dbsvc.DBServiceClient
ctx context.Context
}
func NewDBClient(ctx context.Context) (*ExampleDBClient, error) {
conn, err := grpc.NewClient(ServerAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, fmt.Errorf("failed to dial DB server %q: %w", ServerAddr, err)
}
client := dbsvc.NewDBServiceClient(conn)
return &ExampleDBClient{conn: conn, client: client, ctx: ctx}, nil
}
func (c *ExampleDBClient) Close() error { return c.conn.Close() }
// ListStores example
func (c *ExampleDBClient) exampleListStores() error {
resp, err := c.client.ListStores(c.ctx, &dbquery.ListStores{
Schema: stringPtr("analytics"),
})
if err != nil {
return err
}
fmt.Println("Stores:", resp.Stores)
return nil
}
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := NewDBClient(ctx)
if err != nil {
log.Fatalf("Failed to create DB client: %v", err)
}
defer client.Close()
if err := client.exampleListStores(); err != nil {
log.Fatalf("ListStores failed: %v", err)
}
}
Rust
use ahnlich_client_rs::db::DbClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Connect to your running ahnlich-db instance
let db_client = DbClient::new("127.0.0.1:1369".to_string()).await?;
let tracing_id: Option<String> = None;
// Call list_stores and print the result
let stores = db_client
.list_stores_with_schema(Some("analytics".to_string()), tracing_id)
.await?;
println!("Stores: {:?}", stores);
Ok(())
}
LISTSTORES- Python
- Node.js
- Go
- Rust
- CLI
Python
import asyncio
from grpclib.client import Channel
from ahnlich_client_py.grpc.services.ai_service import AiServiceStub
from ahnlich_client_py.grpc.ai import query as ai_query
async def list_stores():
async with Channel(host="127.0.0.1", port=1370) as channel:
client = AiServiceStub(channel)
response = await client.list_stores(ai_query.ListStores(schema="analytics"))
print(response) #StoreList(stores=[AiStoreInfo(name='my_store', embedding_size=384)])
if __name__ == "__main__":
asyncio.run(list_stores())
TypeScript
import { createAiClient } from "ahnlich-client-node";
import { ListStores } from "ahnlich-client-node/grpc/ai/query_pb";
async function listStores() {
const client = createAiClient("127.0.0.1:1370");
const response = await client.listStores(new ListStores({ schema: "analytics" }));
console.log(response.stores.map((s) => s.name));
for (const store of response.stores) {
console.log(`Store: ${store.name}`);
console.log(` Query Model: ${store.queryModel}`);
console.log(` Index Model: ${store.indexModel}`);
console.log(` Embedding Size: ${store.embeddingSize}`);
}
}
listStores();
Go
package main
import (
"context"
"fmt"
"log"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
aiquery "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/ai/query"
aisvc "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/services/ai_service"
)
const AIAddr = "127.0.0.1:1370"
// ExampleAIClient holds the gRPC connection and AI client.
func stringPtr(value string) *string { return &value }
type ExampleAIClient struct {
conn *grpc.ClientConn
client aisvc.AIServiceClient
ctx context.Context
}
// NewAIClient connects to the AI server and returns a client.
func NewAIClient(ctx context.Context) (*ExampleAIClient, error) {
conn, err := grpc.DialContext(ctx, AIAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
return nil, fmt.Errorf("failed to dial AI server %q: %w", AIAddr, err)
}
client := aisvc.NewAIServiceClient(conn)
return &ExampleAIClient{conn: conn, client: client, ctx: ctx}, nil
}
// Close closes the gRPC connection.
func (c *ExampleAIClient) Close() error {
return c.conn.Close()
}
// ---- ListStores Example ----
// List stores in the analytics schema on the AI server.
func (c *ExampleAIClient) exampleListStoresAI() error {
resp, err := c.client.ListStores(c.ctx, &aiquery.ListStores{Schema: stringPtr("analytics")})
if err != nil {
return err
}
fmt.Println(" AI Stores:", resp.Stores)
return nil
}
// ---- MAIN ----
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := NewAIClient(ctx)
if err != nil {
log.Fatalf("Failed to create AI client: %v", err)
}
defer client.Close()
if err := client.exampleListStoresAI(); err != nil {
log.Fatalf("ListStores failed: %v", err)
}
}
Rust
use ahnlich_client_rs::ai::AiClient;
use ahnlich_client_rs::error::AhnlichError;
#[tokio::main]
async fn main() -> Result<(), AhnlichError> {
let addr = "127.0.0.1:1370";
let client = AiClient::new(addr.to_string()).await?;
let stores = client
.list_stores_with_schema(Some("analytics".to_string()), None)
.await?;
println!("Stores: {:?}", stores);
Ok(())
}
LISTSTORESResponse
A collection of store summaries.