import pymysql # --- Verbindung herstellen --- connection = pymysql.connect( host='10.0.1.123', user='hubobel', password='polier2003', database='hubobel', charset='utf8mb4', cursorclass=pymysql.cursors.Cursor ) try: with connection.cursor() as cursor: # Beispielwerte z1, z2, z3, z4, z5 = 10, 22, 38, 42, 48 # --- Prüfabfrage: existiert diese Kombination? --- sql_check = """ SELECT 1 FROM `euro` WHERE z1 = %s AND z2 = %s AND z3 = %s AND z4 = %s AND z5 = %s LIMIT 1 """ cursor.execute(sql_check, (z1, z2, z3, z4, z5)) exists = cursor.fetchone() is not None if exists: print("✅ Kombination existiert bereits.") else: print("🆕 Kombination ist neu – kann eingefügt werden.") finally: connection.close()