0

I have a Flask webapp running on Ubuntu server with tabular data. (1 table/user) I intend to make a csv file of such data and make it available for download. (No user authentication applied, username acts as unique identifier)

I can create a CSV file in python but the question is where to store it and how can I make it easily available for download. Also I need to have a mechanism to update the CSV when user makes a change.

Harvey
  • 184
  • 1
  • 3
  • 15
  • 1
    Why CSV? I would think SQLite would be easier to update – OneCricketeer Mar 16 '16 at 05:38
  • The end users are data analysts. Hence the ulterior motive is to present them with a downloadable CSV file which is easier to use on other analytics platforms. – Harvey Mar 16 '16 at 05:42
  • Gotcha. Well, you can serve a CSV just like CSS/JS/HTML are served. With a static file handler – OneCricketeer Mar 16 '16 at 05:46
  • Does this help http://stackoverflow.com/questions/10522830/how-to-export-sqlite-to-csv-in-python-without-being-formatted-as-a-list . Create a csv file when asked for it. Could use some sort of update flag to stop necessary calculations of the csv file. – Anirudh Mar 16 '16 at 05:47
  • @cricket_007 I would really appreciate it if you could elaborate that. – Harvey Mar 16 '16 at 05:50
  • @Anirudh I know how to make a CSV file. The only concern is where to store it and how to server them for downloads. – Harvey Mar 16 '16 at 05:52
  • In you flask server write a function as described in the post http://stackoverflow.com/questions/10522830/how-to-export-sqlite-to-csv-in-python-without-being-formatted-as-a-list . You can store the file in any /tmp sort of directory. As for downloadable link any of the format http://domainname/output.csv , when requested by the user will give the file for download. – Anirudh Mar 16 '16 at 06:42

0 Answers0