(path: Path, table: str)
| 101 | |
| 102 | |
| 103 | def _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 | # --------------------------------------------------------------------------- |
no test coverage detected