Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:666ghj BettaFish DatabaseManager show statistics

From Leeroopedia
Knowledge Sources
Domains Database, Data_Management
Last Updated 2026-10-08 00:00 GMT

Overview

Concrete database management tool that provides statistics and inspection methods for the MindSpider crawled data across all platform tables.

Description

The DatabaseManager class connects to the MindSpider database and provides methods to:

  • List all tables in the database
  • Show statistics (row counts per table, news/topic counts, crawling task status)
  • Show recent data (within configurable days)
  • Display platform-specific content counts (xhs_note, douyin_aweme, kuaishou_video, bilibili_video, weibo_note, tieba_note, zhihu_content)

Usage

Import this class when you need to inspect or manage the MindSpider database. It is used for data verification and maintenance.

Code Reference

Source Location

  • Repository: BettaFish
  • File: `MindSpider/schema/db_manager.py:L30-298`

Signature

class DatabaseManager:
    def __init__(self):
        """Initialize with database connection from settings."""

    def show_tables(self) -> List[str]:
        """List all tables in the database."""

    def show_statistics(self) -> Dict[str, Any]:
        """Show comprehensive database statistics."""

    def show_recent_data(self, days: int = 7) -> Dict[str, Any]:
        """Show data from the last N days."""

Import

from MindSpider.schema.db_manager import DatabaseManager

I/O Contract

Inputs

Name Type Required Description
days int No Days to look back (default: 7)

Outputs

Name Type Description
statistics Dict Table counts, news/topic stats, platform content counts

Usage Examples

Show Database Statistics

from MindSpider.schema.db_manager import DatabaseManager

mgr = DatabaseManager()
stats = mgr.show_statistics()
for table, count in stats.items():
    print(f"  {table}: {count}")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment