Files
iddaai-be/scripts/search_match.py
fahricansecer 2f0b85a0c7
Deploy Iddaai Backend / build-and-deploy (push) Failing after 18s
first (part 2: other directories)
2026-04-16 15:11:25 +03:00

38 lines
1.4 KiB
Python
Executable File

import os
import psycopg2
from psycopg2.extras import RealDictCursor
SEARCH_TERM = '8yl'
def search():
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()
print(f"Searching for ID starting with '{SEARCH_TERM}' in live_matches...")
cursor.execute("SELECT id, match_name FROM live_matches WHERE id LIKE %s", (SEARCH_TERM + '%',))
live_rows = cursor.fetchall()
for r in live_rows:
print(f"LIVE FOUND: {r['id']} | {r['match_name']}")
print(f"\nSearching for ID starting with '{SEARCH_TERM}' in matches...")
cursor.execute("SELECT id, sport, mst_utc FROM matches WHERE id LIKE %s", (SEARCH_TERM + '%',))
match_rows = cursor.fetchall()
for r in match_rows:
print(f"ARCHIVE FOUND: {r['id']} | {r['sport']}")
if not live_rows and not match_rows:
print("\n❌ No matches found with that partial ID.")
print("\nShowing first 10 live matches as sample:")
cursor.execute("SELECT id, match_name FROM live_matches LIMIT 10")
for r in cursor.fetchall():
print(f"SAMPLE: {r['id']} | {r['match_name']}")
except Exception as e:
print(e)
if __name__ == "__main__":
search()