MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _row_count

Function _row_count

tests/integration/test_session_export.py:103–111  ·  view source on GitHub ↗
(path: Path, table: str)

Source from the content-addressed store, hash-verified

101
102
103def _row_count(path: Path, table: str) -> int:
104 if not path.exists():
105 return 0
106
107 with sqlite3.connect(str(path)) as conn:
108 try:
109 return conn.execute(f"SELECT COUNT(*) FROM {table}").fetchone()[0]
110 except sqlite3.OperationalError:
111 return 0
112
113
114# ---------------------------------------------------------------------------

Calls 3

existsMethod · 0.80
executeMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected