This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
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()
|
||||
Reference in New Issue
Block a user