File size: 545 Bytes
68f9b9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sqlite3
import os

db_path = os.path.join("neurosense", "data", "neurosense.db")
if os.path.exists(db_path):
    conn = sqlite3.connect(db_path)
    cursor = conn.cursor()
    cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
    tables = cursor.fetchall()
    for table in tables:
        name = table[0]
        cursor.execute(f"SELECT count(*) FROM {name};")
        count = cursor.fetchone()[0]
        print(f"Table {name}: {count} rows")
    conn.close()
else:
    print(f"Database file not found at: {db_path}")