Open pudo opened 8 years ago
Yes! This means Babbage itself can return a stream to write directly to a file server for static aggregation.
@akariv we'd certainly want to be able to write aggregate endpoints for a single package as CSV.
We are definitely doing this, but it might be in the next sprint so I'm putting on backlog for now.
This seems to be implemented but generates invalid CSV when the values contain commas because it's just joining values with , https://github.com/openspending/babbage/blob/master/babbage/api.py#L75
It should probably use https://docs.python.org/2/library/csv.html#csv.DictWriter
All HTTP API queries should be able to return a simple CSV response. In a fancy scenario, this would allow switching between naming the columns according to logical model fields and the original column names which are mentioned in the model.
This should use streaming responses, rather than pre-generating the full response.