Code Room
Code reviewMediumcr-g613
Subject Storage backup verifyLevel Mid–Senior~20 minCommon in Storage & CDN interviewsIndustries Software development, Technology

Question

Review this Python nightly database backup job.

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.

Talk through your review
Code to reviewpython
import subprocess, datetime def nightly_backup(db_url, bucket):    name = f"backup-{datetime.date.today()}.sql.gz"    cmd = f"pg_dump {db_url} | gzip > /tmp/{name}"    subprocess.run(cmd, shell=True)    upload(bucket, f"/tmp/{name}")    alert("Backup completed successfully")
Run or narrate your approach, then ask the coach.