File size: 752 Bytes
2dabb56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sqlite3
import json

def inspect():
    conn = sqlite3.connect('data/eatlytic.db')
    conn.row_factory = sqlite3.Row
    try:
        row = conn.execute("SELECT * FROM scans ORDER BY id DESC LIMIT 1").fetchone()
        if row:
            print(f"ID: {row['id']}")
            print(f"Product: {row['product_name']}")
            print(f"Calories: {row['calories']}")
            print(f"Protein: {row['protein']}")
            print(f"Fat: {row['fat']}")
            print(f"Carbs: {row['carbs']}")
            print(f"Analysis JSON: {row['analysis_json']}")
        else:
            print("No scans found.")
    except Exception as e:
        print(f"Error: {e}")
    finally:
        conn.close()

if __name__ == '__main__':
    inspect()