List store entries
Retrieve entries from a store in deterministic, cursor-paginated pages.
This operation works on both Vector DB stores and AI stores. Use the Database engine / AI proxy switch in the sample below.
Parameters
| Parameter | Type | Description |
|---|---|---|
store | string | Name of the store to list. |
cursor | string · optional | Opaque cursor returned by the previous request. |
limit | integer · optional | Entries per page. Defaults to 100; maximum is 1000. |
condition | predicate · optional | Metadata predicate used to filter entries. |
schema | string · optional | Schema containing the store. Defaults to public. |
Behavior
- Returns entries in deterministic order.
- Returns
next_cursorwhen another page is available. - Applies
conditionbefore pagination when a metadata filter is provided. - The DB response contains vector keys. The AI response contains the original input when the store preserves it.
note
Treat the cursor as opaque. Pass next_cursor back unchanged; do not parse or construct it.
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.db import query as db_query
from ahnlich_client_py.grpc.services.db_service import DbServiceStub
async def list_entries():
async with Channel(host="127.0.0.1", port=1369) as channel:
client = DbServiceStub(channel)
cursor = None
while True:
response = await client.list_store_entries(
db_query.ListStoreEntries(
store="movies",
schema="public",
cursor=cursor,
limit=100,
)
)
for entry in response.entries:
print(entry.key, entry.value)
if response.next_cursor is None:
break
cursor = response.next_cursor
asyncio.run(list_entries())
TypeScript
import { createDbClient } from "@deven96/ahnlich-client-node";
import { ListStoreEntries } from "@deven96/ahnlich-client-node/grpc/db/query_pb";
const client = createDbClient("127.0.0.1:1369");
let cursor: string | undefined;
do {
const page = await client.listStoreEntries(
new ListStoreEntries({
store: "movies",
schema: "public",
cursor,
limit: 100,
}),
);
for (const entry of page.entries) {
console.log(entry.key?.key, entry.value?.value);
}
cursor = page.nextCursor;
} while (cursor !== undefined);
Go
package main
import (
"context"
"fmt"
dbquery "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/db/query"
dbsvc "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/services/db_service"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
func main() {
conn, err := grpc.NewClient(
"127.0.0.1:1369",
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
panic(err)
}
defer conn.Close()
client := dbsvc.NewDBServiceClient(conn)
limit := uint32(100)
schema := "public"
var cursor *string
for {
page, err := client.ListStoreEntries(
context.Background(),
&dbquery.ListStoreEntries{
Store: "movies",
Schema: &schema,
Cursor: cursor,
Limit: &limit,
},
)
if err != nil {
panic(err)
}
for _, entry := range page.Entries {
fmt.Println(entry.Key, entry.Value)
}
if page.NextCursor == nil {
break
}
cursor = page.NextCursor
}
}
Rust
use ahnlich_client_rs::db::DbClient;
use ahnlich_types::db::query::ListStoreEntries;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = DbClient::new("http://127.0.0.1:1369".to_string()).await?;
let mut cursor = None;
loop {
let page = client
.list_store_entries(
ListStoreEntries {
store: "movies".to_string(),
cursor,
limit: Some(100),
condition: None,
schema: Some("public".to_string()),
},
None,
)
.await?;
for entry in page.entries {
println!("{entry:?}");
}
match page.next_cursor {
Some(next) => cursor = Some(next),
None => break,
}
}
Ok(())
}
Text
LISTSTOREENTRIES movies LIMIT 100 WHERE (genre = drama) SCHEMA public
Use the next_cursor returned by the previous page to fetch the next page:
Text
LISTSTOREENTRIES movies LIMIT 100 CURSOR 00000000000000ff WHERE (genre = drama) SCHEMA public
- Python
- Node.js
- Go
- Rust
- CLI
Python
import asyncio
from grpclib.client import Channel
from ahnlich_client_py.grpc.ai import query as ai_query
from ahnlich_client_py.grpc.services.ai_service import AiServiceStub
async def list_entries():
async with Channel(host="127.0.0.1", port=1370) as channel:
client = AiServiceStub(channel)
cursor = None
while True:
response = await client.list_store_entries(
ai_query.ListStoreEntries(
store="movies",
schema="public",
cursor=cursor,
limit=100,
)
)
for entry in response.entries:
print(entry.key, entry.value)
if response.next_cursor is None:
break
cursor = response.next_cursor
asyncio.run(list_entries())
TypeScript
import { createAiClient } from "@deven96/ahnlich-client-node";
import { ListStoreEntries } from "@deven96/ahnlich-client-node/grpc/ai/query_pb";
const client = createAiClient("127.0.0.1:1370");
let cursor: string | undefined;
do {
const page = await client.listStoreEntries(
new ListStoreEntries({
store: "movies",
schema: "public",
cursor,
limit: 100,
}),
);
for (const entry of page.entries) {
console.log(entry.key, entry.value?.value);
}
cursor = page.nextCursor;
} while (cursor !== undefined);
Go
package main
import (
"context"
"fmt"
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"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
func main() {
conn, err := grpc.NewClient(
"127.0.0.1:1370",
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
panic(err)
}
defer conn.Close()
client := aisvc.NewAIServiceClient(conn)
limit := uint32(100)
schema := "public"
var cursor *string
for {
page, err := client.ListStoreEntries(
context.Background(),
&aiquery.ListStoreEntries{
Store: "movies",
Schema: &schema,
Cursor: cursor,
Limit: &limit,
},
)
if err != nil {
panic(err)
}
for _, entry := range page.Entries {
fmt.Println(entry.Key, entry.Value)
}
if page.NextCursor == nil {
break
}
cursor = page.NextCursor
}
}
Rust
use ahnlich_client_rs::ai::AiClient;
use ahnlich_types::ai::query::ListStoreEntries;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = AiClient::new("http://127.0.0.1:1370".to_string()).await?;
let mut cursor = None;
loop {
let page = client
.list_store_entries(
ListStoreEntries {
store: "movies".to_string(),
cursor,
limit: Some(100),
condition: None,
schema: Some("public".to_string()),
},
None,
)
.await?;
for entry in page.entries {
println!("{entry:?}");
}
match page.next_cursor {
Some(next) => cursor = Some(next),
None => break,
}
}
Ok(())
}
Text
LISTSTOREENTRIES movies LIMIT 100 WHERE (genre = drama) SCHEMA public
Use the next_cursor returned by the previous page to fetch the next page:
Text
LISTSTOREENTRIES movies LIMIT 100 CURSOR 00000000000000ff WHERE (genre = drama) SCHEMA public
Response
The response contains the current page in entries. When next_cursor is absent, the final page has been reached.
To filter entries, provide a PredicateCondition through condition.