forked from EwShen/SafeSwap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
28 lines (23 loc) · 728 Bytes
/
test.py
File metadata and controls
28 lines (23 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sqlite3
# Connect to your database file
conn = sqlite3.connect('microplastics.sqlite')
cursor = conn.cursor()
# Show all tables
print("Tables in database:")
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
for table in tables:
print("-", table[0])
# Show schema of scan_history table
print("\nSchema of scan_history table:")
cursor.execute("PRAGMA table_info(scan_history);")
columns = cursor.fetchall()
for col in columns:
print(f"{col[1]} ({col[2]})")
# Show 5 rows from scan_history
print("\nRecent scans:")
cursor.execute("SELECT * FROM scan_history ORDER BY time_scanned DESC LIMIT 5;")
rows = cursor.fetchall()
for row in rows:
print(row)
conn.close()