Code Room
Code reviewMedium
Question
Review this Python function that exports events to a downstream job.
The `events` table grows by ~5M rows/day and `since` is often the start of the month.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
def export_events(conn, since): cur = conn.cursor() cur.execute( "SELECT id, payload FROM events WHERE created_at >= %s ORDER BY created_at", (since,), ) rows = cur.fetchall() # pull everything results = [] for row in rows: results.append(transform(row)) return resultsRun or narrate your approach, then ask the coach.