Vote count:
0
I am trying to export information about users of my Rails app (that's hosted by Heroku). I followed this tutorial to export a CSV file:
This involved the following:
Connecting to post-gres database:
psql "dbname=foo host=bar.compute-1.amazonaws.com user=abc password=123 port=5432 sslmode=require"
Running a query:
\copy (SELECT id, sign_in_count, last_sign_in_at, created_at FROM users) TO dump.csv CSV DELIMITER ','
This exported the CSV file to my current directory.
However, I'd also like to include an associated model in the query - for example, in my app, users created projects, and I'd like to export the number of projects each user has created.
How can I update my query to do this?
asked 1 min ago
Exporting CSV from Heroku Rails app - Adding Associations
Aucun commentaire:
Enregistrer un commentaire