2021年2月2日星期二

How to download data from Dash-Heroku app linked to AWS Postgres RDS into a computer?

I'm kind of new to web applications, so here is my problem.

I developed an interactive dashboard with Plotly's Dash that connects to an RDS postgres instance of AWS via psycopg2 (Before that, it was connected to a local instance of psql, and it works the same).

The database hosts data from Mexico's electricity market and is around 9 GB big. In the dashboard I gave the opportunity to download information from the database (selecting time interval and other things which are just extra factors inside the WHERE clause).

I was able to use the command cursor.copy_expert(SQL-QUERY, outfile-path) to download the file to a specified folder when the python code was launched locally in my computer.

I decided to host my app in Heroku, and the database in AWS. Everything works perfectly, except data download to computer, it doesn't work at all.

The thing is, How can I use that command (Or is there other I should use?) in order to make a SQL query to the database and download the results as a CSV to the computer accesing the heroku page?

Information downloaded range from less than 1 MB to 1 GB.

I have not been able to find out a way to solve this, Please help.

Thanks!

https://stackoverflow.com/questions/66020269/how-to-download-data-from-dash-heroku-app-linked-to-aws-postgres-rds-into-a-comp February 03, 2021 at 10:06AM

没有评论:

发表评论