diff --git a/scripts/load_cornfield.py b/scripts/load_cornfield.py index 10130d8b..5dafdbe3 100644 --- a/scripts/load_cornfield.py +++ b/scripts/load_cornfield.py @@ -35,11 +35,11 @@ CONTAINER = "arxiv-pg" # ── Postgres helpers ────────────────────────────────────────────────────────── def neon(sql: str, timeout: int = 60) -> str: - """Run SQL on neon-64gb arxiv DB, return stdout.""" + """Run SQL on neon-64gb arxiv DB, return stdout. Uses stdin pipe to avoid shell escaping.""" r = subprocess.run( ["ssh", NEON_HOST, - f"podman exec {CONTAINER} psql -U postgres -d arxiv -t -A -c \"{sql}\""], - capture_output=True, text=True, timeout=timeout, + f"podman exec -i {CONTAINER} psql -U postgres -d arxiv -t -A"], + input=sql, capture_output=True, text=True, timeout=timeout, ) if r.returncode != 0: print(f" NEON ERR: {r.stderr[:200]}")