
import os
import psycopg2
from psycopg2.extras import RealDictCursor

def find_teams():
    try:
        db_url = os.environ.get('DATABASE_URL', 'postgresql://suggestbet:SuGGesT2026SecuRe@localhost:15432/boilerplate_db')
        conn = psycopg2.connect(db_url, cursor_factory=RealDictCursor)
        cursor = conn.cursor()
        
        cursor.execute("SELECT id, name FROM teams WHERE name ILIKE '%Eyüp%' OR name ILIKE '%Beşiktaş%'")
        rows = cursor.fetchall()
        print("Found Teams:")
        for r in rows:
            print(f"ID: {r['id']} | Name: {r['name']}")
            
    except Exception as e:
        print(e)

if __name__ == "__main__":
    find_teams()
