MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / count

Method count

trinity/buffer/storage/sql.py:246–259  ·  view source on GitHub ↗
(self, filters: Optional[Dict] = None)

Source from the content-addressed store, hash-verified

244 return conditions
245
246 async def count(self, filters: Optional[Dict] = None) -> int:
247 await self.prepare()
248
249 async def operation(session: AsyncSession):
250 stmt = select(func.count()).select_from(self.table_model_cls)
251 conditions = self._build_filter_conditions(filters)
252 if conditions:
253 stmt = stmt.where(and_(*conditions))
254 result = await session.execute(stmt)
255 return result.scalar()
256
257 return await async_run_with_retry_session(
258 self.session, operation, self.max_retry_times, self.max_retry_interval
259 )
260
261 async def query(
262 self, offset: int = 0, limit: int = 10, filters: Optional[Dict] = None

Callers 2

operationMethod · 0.45

Calls 2

prepareMethod · 0.95

Tested by 1