Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Update uploaded file name
Browse files Browse the repository at this point in the history
  • Loading branch information
bram-vdberg committed Nov 4, 2024
1 parent 88e70b0 commit 54e22cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/deploy_prefect/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,5 @@ def prod_order_rewards() -> None:
blockrange = get_block_range()
orderbook = fetch_orderbook(blockrange)
data = cast_orderbook_to_dune_string(orderbook)
table_name = upload_data_to_dune(
data, blockrange.block_from, blockrange.block_to, config
)
table_name = upload_data_to_dune(data, blockrange.block_from, blockrange.block_to)
update_aggregate_query(table_name, config)
8 changes: 6 additions & 2 deletions src/deploy_prefect/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
from io import StringIO
from typing import Optional
from datetime import datetime, timezone

import requests
Expand Down Expand Up @@ -77,13 +78,16 @@ def cast_orderbook_to_dune_string(orderbook: pd.DataFrame) -> str:

@task # type: ignore[misc]
def upload_data_to_dune(
data: str, block_start: int, block_end: int, config: Config
data: str, block_start: int, block_end: int, config: Optional[Config] = None
) -> str:
"""
Uploads the order rewards data to Dune,
either creating a new query or updating an existing one
"""
table_name = f"order_rewards_{config.env}_{block_start}"
if config:
table_name = f"order_rewards_{config.env}_{block_start}"
else:
table_name = f"order_rewards_{block_start}"
dune = DuneClient.from_env()
dune.upload_csv( # type: ignore[attr-defined]
data=data,
Expand Down

0 comments on commit 54e22cf

Please sign in to comment.