kacpermuda commented on code in PR #76750:
URL: https://github.com/apache/airflow/pull/76750#discussion_r4641981407
##########
airflow-core/src/airflow/listeners/types.py:
##########
@@ -34,6 +34,9 @@
class AssetEvent:
"""Asset event representation for asset listener hooks."""
+ id: int
Review Comment:
Good question. The intent is that only core builds this type: it’s
constructed in exactly one place (`AssetManager.register_asset_change`), and
listeners only receive instances through the `on_asset_event_emitted` hookspec.
I grepped the repo, including providers and task-sdk, for other uses of
`airflow.listeners.types` and found none. Core already passes every field as a
keyword argument, so the new required fields at the front can’t mis-assign
anything.
I left them at the start because moving them behind `partition_date` would
need defaults, which makes no sense for a persisted event’s `id`, `timestamp`
and `asset_id`. Alternatively they’d need `kw_only=True` on those fields, which
adds complexity for a type nobody outside core constructs. Happy to do that if
you’d rather be strict about it, but I think the current ordering is fine.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]