in backend/time-series-forecasting/utils.py [0:0]
def download_bq_table(bq_table_uri: str) -> pd.DataFrame:
"""This function downloads a BigQuery table and returns a dataframe
Args:
bq_table_uri (str): BigQuery uri of the table
Returns:
pd.DataFrame: table data in dataframe format
"""
# Remove bq:// prefix if present
prefix = "bq://"
if bq_table_uri.startswith(prefix):
bq_table_uri = bq_table_uri[len(prefix) :]
client = bigquery.Client()
table = client.get_table(bq_table_uri)
rows = client.list_rows(table)
return rows.to_dataframe()