Spaces:
Sleeping
Sleeping
Download query_users.py from Anil1515/chess-baackend: direct link, hf CLI and curl.
- Browser
- Download file 305 Bytes
-
https://huggingface.co/spaces/Anil1515/chess-baackend/resolve/main/query_users.py
- Command line
-
hf download hf://spaces/Anil1515/chess-baackend/query_users.py
-
curl -L -o query_users.py https://huggingface.co/spaces/Anil1515/chess-baackend/resolve/main/query_users.py
305 Bytes
| import psycopg2 | |
| DB_URL = 'postgresql://postgres:Rana1515@localhost:5432/chess_db' | |
| conn = psycopg2.connect(DB_URL) | |
| cur = conn.cursor() | |
| cur.execute("SELECT username, email, created_at FROM users ORDER BY created_at DESC LIMIT 5") | |
| rows = cur.fetchall() | |
| for r in rows: | |
| print(r) | |
| cur.close() | |
| conn.close() | |