Skip to content
中文

Count matching database rows without retrieving data

Code Mode: praxis.database.count

SDK helper: it has no HTTP endpoint of its own and is called from Code Mode and the SDK.

Count rows in an existing table using HEAD. Filters use the same PostgREST query parameters as databaseSelect, for example { status: “eq.active” }. Defaults to exact. Unfiltered counts are exact in every mode; with filters, exact counts within budget, planned returns an unknown total, and estimated may return an unknown total when over budget. Returns { count: number | null }; null means Content-Range reports an unknown total, not zero.

Signature

praxis.database.count(input: {
/** Database ID from database list/create, not its display name. */
database_id: string;
/** Existing table name or ID from the database table APIs. */
table: string;
/** PostgREST query filters as in databaseSelect; omitted means all rows. */
filters?: Record<string, string>;
/** exact (default) counts within budget; filtered planned returns null; estimated may return null over budget. Unfiltered counts are exact in every mode. */
count?: 'exact' | 'planned' | 'estimated';
}): Promise<{
/** Matching total, or null when the server reports an unknown total. */
count: number | null;
}>;