Skip to content

Commit

Permalink
workaround for postgres has problems writing to the tmpfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneberger committed Dec 29, 2024
1 parent dace470 commit 43c9985
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/data-hoarder/postgres.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
OUT_FOLDER=/var/lib/pub-files/postgres-dumps/$(date -d"$(date) - 1 day" +"%Y-%m")
CSV_FILENAME=$(date -d"$(date) - 1 day" +"%Y-%m-%d").csv
psql -d tlms -c "COPY (SELECT id, to_char(time::timestamp at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS') time, station, r09_type, delay, reporting_point, junction, direction, request_status, priority, direction_request, line, run_number, destination_number, train_length, vehicle_number, operator, region FROM r09_telegrams WHERE time > now() - interval '24 hours' ORDER by time ASC) TO '$TMPFILE' DELIMITER ',' HEADER CSV;"
psql -d tlms -c "COPY (SELECT id, to_char(time::timestamp at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS') time, station, r09_type, delay, reporting_point, junction, direction, request_status, priority, direction_request, line, run_number, destination_number, train_length, vehicle_number, operator, region FROM r09_telegrams WHERE time > now() - interval '24 hours' ORDER by time ASC) TO STDOUT DELIMITER ',' HEADER CSV;" > $TMPFILE
mkdir -p $OUT_FOLDER
chmod a+xr $OUT_FOLDER
Expand Down

0 comments on commit 43c9985

Please sign in to comment.