How do you export a Postgres database to CSV when you do NOT have superuser privileges?
The line of code in question (for my Bargain Stock Funds project at https://github.com/jhsu802701/bsf-scrape/blob/master/scrape.rb) is:
@conn.exec("COPY funds TO '" + csv_path + "' With CSV HEADER;")
I need superuser access in order to run this code. This is OK in the development environment, because I used my root privileges (through sudo) to give my username superuser status for Postgres.
However, this does not work in the production environment. where so my username doesn’t have superuser status.
Is there another way to create a CSV file from a Postgres database?