Files
sale/scripts/check_categories.py
T

13 lines
441 B
Python

import sqlite3
conn = sqlite3.connect('backend/sale.db')
cursor = conn.cursor()
cursor.execute("SELECT id, name FROM categories")
print("Categories in database:")
for row in cursor.fetchall():
print(f" ID: {row[0]}, Name: {row[1]}")
cursor.execute("SELECT product_id, category_id FROM product_categories")
print("\nProduct-Category relations:")
for row in cursor.fetchall():
print(f" Product ID: {row[0]}, Category ID: {row[1]}")