import mysql.connector

conn = mysql.connector.connect(
    host="85.215.144.168",
    port=3306,
    database="pastelerias",
    user="asesoft",
    password="Pantera1"
)
cursor = conn.cursor(dictionary=True)

# 1. Search for this process_id in ob_recetas
cursor.execute("SELECT * FROM ob_recetas WHERE id = '453e2812757a5508700003cf8f485451';")
print("In ob_recetas:", cursor.fetchone())

# 2. Search for this process_id in ob_recetas_procesos
cursor.execute("SELECT * FROM ob_recetas_procesos WHERE id = '453e2812757a5508700003cf8f485451';")
print("In ob_recetas_procesos:", cursor.fetchone())

# 3. Check what is the recipe_id of the ingredients before migration.
# Wait! Since we renamed the table and dropped receta_id, did the database copy of the ingredients
# get updated with a WRONG proceso_id?
# Let's inspect the ingredients that have '453e2812757a5508700003cf8f485451' as proceso_id.
# What id_materia_prima do they have, and does that help us identify which recipe they belonged to?
cursor.execute("""
    SELECT i.id, i.proceso_id, i.id_materia_prima, m.descripcion as mat_desc
    FROM ob_procesos_ingredientes i
    LEFT JOIN ge_materias_primas m ON i.id_materia_prima = m.id
    WHERE i.proceso_id = '453e2812757a5508700003cf8f485451';
""")
print("\nIngredients with this process_id:")
for row in cursor.fetchall():
    print("  ", row)

cursor.close()
conn.close()
