-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export all survey tables to CSV #426
Conversation
417e5f9
to
75a8053
Compare
This also needs a management command, so it can run like this: $ ./scripts/manage.sh beekeepers_export
+ ARGS=beekeepers_export
+ [[ 1 -eq 1 ]]
+ [[ beekeepers_export == runserver ]]
+ vagrant ssh app -c 'cd /opt/app && envdir /etc/icp.d/env ./manage.py beekeepers_export'
Export Complete
Connection to 127.0.0.1 closed. I added a commit for that (since it was easier than writing it out in a comment). Currently any new export overwrites the old files. Can we make it so that the exports are zipped into an archive with a timestamp, so that later exports do not overwrite the old ones? |
Can we have the CSV export quote string and date fields? The current export looks like this:
whereas it should look like this:
That'll protect from any commas in the content (which may be in the free-entry fields). |
01eda9c
to
c67d67d
Compare
The good news is that postgres or
|
Heads up that there's a merge conflict now. |
Saves separate CSVs to the 'exports' folder Refs #384
The CSVs are created in-memory and returned to the user so there are no artifacts left on the server. We don't expect the database to get large enough to warrant memory issues. Refs #384
The task suggested adding this functionality to Django's admin interface. The admin view is however not easily customizable. Downloading the zip file from an endpoint was more possible and straightforward and is pretty flexible. Refs #385
c67d67d
to
bc000dc
Compare
Ready for a look |
Taking a look now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 tested, this works well. Export had the right columns and consistent timestamp. With a few cleanup commits this should be ready.
Thanks! Helpful clean up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still needs a couple of fixes before it's green.
289d04c
to
fd5caec
Compare
It is better UX to have CSV download access via the front-end than to log into the django admin or remember a URL. Refs #385
fd5caec
to
dd41f79
Compare
Taking another look. |
f23c0ff
to
e371fce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 tested. Good work!
😅 Thanks for the reviews. |
Overview
Site admins want the data as CSV to do analyses. This PR adds a view at http://localhost:8000/beekeepers/export for admins to download tables as a zip of CSVs. SQL queries are hardcoded.
Connects #384
Connects #385
Demo
The idea: (i fussed with the filename timestamp a little since this screenshot)
The date formatter doesn't allow colons in the time (only
-
). It's livable. It's main purpose is to give the files a unique ID.Non-admins can't access:
Testing Instructions
Visit the URL and sign in as an admin. Check that the zip downloads and the CSVs look good.