Mid-Level
November 18, 2026Spot the bug: Data Engineering
One snippet. Find the bug, or prove there isn't one.
python
1import psycopg2
2
3def get_user_orders(conn, user_id: str):
4 cursor = conn.cursor()
5 query = f"SELECT id, amount, status FROM orders WHERE user_id = '{user_id}'"
6 cursor.execute(query)
7 rows = cursor.fetchall()
8 cursor.close()
9 return [{"id": r[0], "amount": r[1], "status": r[2]} for r in rows]
10Click the lines that carry the problem.
Your verdict
One attempt per day. The answer shows up right after.
Keep your streak
Create an account to keep your streak and track your progress.