Compare commits
No commits in common. "85698c377bca7405d69c63d13d3ef918d35aaf1a" and "0b8c041ee559af903d6aa1526ed1a59753ab775d" have entirely different histories.
85698c377b
...
0b8c041ee5
1 changed files with 0 additions and 13 deletions
|
|
@ -15,21 +15,9 @@ def has_valid_times(result: pd.DataFrame) -> bool:
|
|||
return False
|
||||
return True
|
||||
|
||||
def are_keys_unique(db: Path, table: str, col: str) -> bool:
|
||||
conn = sqlite3.connect(db)
|
||||
c = conn.cursor()
|
||||
c.execute(f"SELECT COUNT( DISTINCT CAST(path AS nvarchar(4000))), COUNT({col}) FROM {table};")
|
||||
results = c.fetchall()[0]
|
||||
conn.close()
|
||||
return bool(results[0] == results[1])
|
||||
|
||||
|
||||
def check_db_integrity(path: Path) -> None:
|
||||
db = get_db_file(path)
|
||||
|
||||
if not are_keys_unique(db, 'backlogs', 'path'):
|
||||
raise Exception("The paths the backlog table of the database links are not unique.")
|
||||
|
||||
search_expr = "SELECT * FROM 'backlogs'"
|
||||
conn = sqlite3.connect(db)
|
||||
results = pd.read_sql(search_expr, conn)
|
||||
|
|
@ -39,7 +27,6 @@ def check_db_integrity(path: Path) -> None:
|
|||
raise ValueError(f"Result with id {result[id]} has wrong time signatures.")
|
||||
|
||||
|
||||
|
||||
def full_integrity_check(path: Path) -> None:
|
||||
check_db_integrity(path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue