Export loads entire month
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.
0:00 of about 22 min
Mark a line and say what kind of problem it is.0 findings
1def export_events(conn, since):
2 cur = conn.cursor()
3 cur.execute(
4 "SELECT id, payload FROM events WHERE created_at >= %s ORDER BY created_at",
5 (since,),
6 )
7 rows = cur.fetchall() # pull everything
8 results = []
9 for row in rows:
10 results.append(transform(row))
11 return results
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.