You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Lee-W (via GitHub)" <gi...@apache.org> on 2026/04/24 10:00:06 UTC

Re: [I] Segment-based partitioning [airflow]

Lee-W commented on issue #57695:
URL: https://github.com/apache/airflow/issues/57695#issuecomment-4312322143

   ```python
   from airflow.sdk import Asset, AllowedKeyMapper, PartitionAtRuntime, asset
   
   region_raw_stats = Asset(
       uri="file://incoming/player-stats/by-region.csv",
       name="region_raw_stats",
   )
   
   # Must be a module-level function so the timetable is serialisable:
   # the scheduler stores its dotted path and re-imports at scheduling time.
   # Lambdas, closures, and bound methods are rejected at construction.
   def list_active_regions() -> list[str]:
       ...
   
   @asset(
       uri="file://analytics/player-stats/regional-breakdown.csv",
       schedule=PartitionAtRuntime(
           assets=region_raw_stats,
           default_partition_mapper=AllowedKeyMapper(list_active_regions),
       ),
   )
   def regional_stats_breakdown():
       ...
   ```
   
   This could be how it works, but will affect #44146 implemented


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org