Skip to content
This repository has been archived by the owner on Feb 21, 2020. It is now read-only.

Exporting voter data to csv

Eduardo Robles Elvira edited this page Jul 2, 2014 · 2 revisions

With agora-election

To get the export data

root@acbox:~# su - aelection
waelection@acbox:~$ workon agora-election
(agora-election) aelection@acbox:~$ cd agora-election/agora_election/
(agora-election) aelection@acbox:~/agora-election/agora_election$  ./app.py -lv --filter status==3 --output-format csv > output.csv

You can also specify which fields from the Voter model in agora-election do you want as output. For example, you might only want the dni and the telephone number:

(agora-election) aelection@acbox:~/agora-election/agora_election$  ./app.py -lv --filter status==3 --output-format csv --output-fields dni,tlf > output.csv

With Postgresql

Log on to the aelection machine, then

su - postgres
psql aelection

Use the postgres copy command

COPY voter TO '/tmp/voters.csv' DELIMITER ',' CSV HEADER;

you can optionally specify columns, for example

COPY voter (tlf,first_name,last_name,email,dni,postal_code) TO '/tmp/voters.csv' DELIMITER ',' CSV HEADER;