Commit c518ab1c authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

DB Helpers: Add SQL command to export a CSV of all organizations, their...

DB Helpers: Add SQL command to export a CSV of all organizations, their relations and the paths of the studies.
parent 5eddc6f3
......@@ -161,4 +161,13 @@ COPY (
GROUP BY name, acronym, relation
ORDER BY name, relation
) TO '/tmp/organizations.csv' DELIMITER ',' CSV HEADER;
COPY (
SELECT name, acronym, relation, study_path
FROM organizations
INNER JOIN study_organization_associations
ON organizations.name = study_organization_associations.organization_name
GROUP BY name, acronym, relation, study_path
ORDER BY name, relation
) TO '/tmp/organizations_with_studies.csv' DELIMITER ',' CSV HEADER;
```
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment