MCPcopy
hub / github.com/tanelpoder/0xtools / get_table_stats

Method get_table_stats

xtop/core/materializer.py:203–226  ·  view source on GitHub ↗

Get row counts and sizes for materialized tables

(self)

Source from the content-addressed store, hash-verified

201 return result
202
203 def get_table_stats(self) -> Dict[str, Dict[str, int]]:
204 """Get row counts and sizes for materialized tables"""
205 stats = {}
206
207 for source, table_name in self.TABLE_NAMES.items():
208 try:
209 # Get row count
210 row_count = self.conn.execute(
211 f"SELECT COUNT(*) FROM {table_name}"
212 ).fetchone()[0]
213
214 # Get approximate table size (this is a rough estimate)
215 col_count = len(self.conn.execute(
216 f"DESCRIBE {table_name}"
217 ).fetchall())
218
219 stats[source] = {
220 'rows': row_count,
221 'columns': col_count
222 }
223 except:
224 stats[source] = {'rows': 0, 'columns': 0}
225
226 return stats

Callers

nothing calls this directly

Calls 2

fetchallMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected