Skip to content

Commit

Permalink
typing
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Jan 29, 2024
1 parent 138811f commit 2660075
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/partition_example/partition_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def realized_vol(context: AssetExecutionContext, orats_daily_prices: pd.DataFram


@asset(io_manager_def="parquet_io_manager", partitions_def=hourly_partitions)
def my_custom_df(context) -> pd.DataFrame:
def my_custom_df(context: AssetExecutionContext) -> pd.DataFrame:
start, end = context.asset_partitions_time_window_for_output()

df = pd.DataFrame({"timestamp": pd.date_range(start, end, freq="5T")})
Expand All @@ -92,7 +92,7 @@ def fetch_blog_posts_from_external_api(*args, **kwargs):


@asset(partitions_def=HourlyPartitionsDefinition(start_date="2022-01-01-00:00"))
def blog_posts(context) -> List[Dict]:
def blog_posts(context: AssetExecutionContext) -> List[Dict]:
partition_datetime_str = context.asset_partition_key_for_output()
hour = datetime.datetime.fromisoformat(partition_datetime_str)
posts = fetch_blog_posts_from_external_api(hour_when_posted=hour)
Expand All @@ -105,7 +105,7 @@ def blog_posts(context) -> List[Dict]:
partitions_def=WeeklyPartitionsDefinition(start_date="2022-11-01"),
key_prefix=["snowflake", "eldermark_proxy"],
)
def resident(context) -> Output[pd.DataFrame]:
def resident(context: AssetExecutionContext) -> Output[pd.DataFrame]:
start, end = context.asset_partitions_time_window_for_output()
filter_str = f"LastMod_Stamp >= {start.timestamp()} AND LastMod_Stamp < {end.timestamp()}"

Expand Down

0 comments on commit 2660075

Please sign in to comment.