Fix csv_export and Makefile

main
mathan 2024-02-20 22:08:14 -08:00
parent 0e01664cfb
commit d6dff5a9a0
2 changed files with 4 additions and 5 deletions

View File

@ -54,7 +54,6 @@ init-db: init.sql
csv-export: csv-export:
@nohup ./csv_export.sh > csv_export.out & @nohup ./csv_export.sh > csv_export.out &
@tail -f csv_export.out
kill-csv-export: kill-csv-export:
@kill -9 `pgrep csv_export.sh` @kill -9 `pgrep csv_export.sh`

View File

@ -32,6 +32,10 @@ docker compose exec -it postgres psql -U postgres -d bluesky \
-c "copy (${likes_query}) to stdout with csv header;" > like_counts.csv -c "copy (${likes_query}) to stdout with csv header;" > like_counts.csv
echo "Done: $(ls -lh like_counts.csv)" echo "Done: $(ls -lh like_counts.csv)"
# ------------------------------ LIKES ----------------------------------
# ------------------------------ REPLIES ----------------------------------
posts_query="$(cat <<- EOF posts_query="$(cat <<- EOF
select repos.did as ":START_ID", subject_did as ":END_ID", "count:long" from select repos.did as ":START_ID", subject_did as ":END_ID", "count:long" from
repos join lateral ( repos join lateral (
@ -41,10 +45,6 @@ posts_query="$(cat <<- EOF
EOF EOF
)" )"
# ------------------------------ LIKES ----------------------------------
# ------------------------------ REPLIES ----------------------------------
echo "Dumping posts..." echo "Dumping posts..."
docker compose exec -it postgres psql -U postgres -d bluesky \ docker compose exec -it postgres psql -U postgres -d bluesky \
-c "copy (${posts_query}) to stdout with csv header;" > post_counts.csv -c "copy (${posts_query}) to stdout with csv header;" > post_counts.csv