import sqlite3 import os DB_PATH = "localfood.db" def check_foods(): if not os.path.exists(DB_PATH): print(f"Database {DB_PATH} not found.") return conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() # Check total count cursor.execute("SELECT COUNT(*) FROM foods") count = cursor.fetchone()[0] print(f"Total foods in DB: {count}") # Check for eggs and bacon print("\nSearching for 'egg':") cursor.execute("SELECT name, category, source FROM foods WHERE name LIKE '%egg%' LIMIT 5") for row in cursor.fetchall(): print(row) print("\nSearching for 'bacon':") cursor.execute("SELECT name, category, source FROM foods WHERE name LIKE '%bacon%' LIMIT 5") for row in cursor.fetchall(): print(row) conn.close() if __name__ == "__main__": check_foods()