Включает модели ML для предсказаний, API маршруты, скрипты обучения и данные. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
25 lines
603 B
Python
25 lines
603 B
Python
from fastapi import APIRouter
|
|
import psycopg2
|
|
from psycopg2.extras import RealDictCursor
|
|
|
|
router = APIRouter()
|
|
|
|
def get_db_connection():
|
|
return psycopg2.connect(
|
|
host="localhost",
|
|
port=5432,
|
|
database="korobka_db",
|
|
user="postgres",
|
|
password="postgres"
|
|
)
|
|
|
|
@router.get("/pro-players")
|
|
def get_pro_players():
|
|
conn = get_db_connection()
|
|
cursor = conn.cursor(cursor_factory=RealDictCursor)
|
|
cursor.execute("SELECT id, name, team_id FROM pro_players ORDER BY id")
|
|
players = cursor.fetchall()
|
|
cursor.close()
|
|
conn.close()
|
|
return players
|