You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you give an example of how to download huge amount of data in csf format from browser/python code? I have something similar to the following right now but it obviously doesnt work. Also, I am not sure how to stream data into the client-side temporary file in small chunks of 10K instead of choking the whole pipe with 100k+ records.
import pandas as pd
from datetime import datetime
from dateutil.relativedelta import relativedelta
from typing import Any
from typing_extensions import Required
from flask import request
from flask_restx import Namespace, Resource, fields
from db import prod_db
@api.route('/daily_order_book')
class DailyOrderBook(Resource):
@api.doc('get_daily_order_book')
@api.marshal_with(daily_order_book_model)
@api.produces(mimetypes="application/vnd.ms-excel")
def get(self):
'''This method retrieves daily order book.'''
today: datetime = datetime.today()
yesterday: datetime = today - relativedelta(days=1)
sql: str = f'''
select * from daily_order_book'
'''
df: pd.DataFrame = prod_db.read(sql=sql)
csv: Any = df.to_csv()
return csv
The text was updated successfully, but these errors were encountered:
Hi,
Can you give an example of how to download huge amount of data in csf format from browser/python code? I have something similar to the following right now but it obviously doesnt work. Also, I am not sure how to stream data into the client-side temporary file in small chunks of 10K instead of choking the whole pipe with 100k+ records.
The text was updated successfully, but these errors were encountered: