Skip to content

Deprecate Asset.extra#64243

Open
uranusjr wants to merge 1 commit intoapache:mainfrom
astronomer:asset-event-extra-template
Open

Deprecate Asset.extra#64243
uranusjr wants to merge 1 commit intoapache:mainfrom
astronomer:asset-event-extra-template

Conversation

@uranusjr
Copy link
Copy Markdown
Member

@uranusjr uranusjr commented Mar 26, 2026

I actually also had event_extra_template implemented locally, but when I was about to write the documentation, I realised its use case is… very limited? It can only be static, and really the worst case scenario without it is you repeat them when you emit events.

Since we generally discourage emitting events of the same asset in different dags anyway, all this really helps would be to save you a few keystrokes. I couldn’t justify to myself to implement it.

Therefore, this PR only contains deprecation to a confusing and not-really-useful feature. It does not provide a replacement.

Close #55200 (without implementing everything it requests—see explaination above)

@uranusjr uranusjr force-pushed the asset-event-extra-template branch from 432cb5c to ef4e7b5 Compare March 26, 2026 06:37
Copy link
Copy Markdown
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The qn posted doesn't have much to do with the PR but a general observation, PR looks good

Comment on lines +124 to +125
# TODO: Deprecated in SDK. Remove in Airflow 4.0.
extra: dict[str, JsonValue]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# TODO: Deprecated in SDK. Remove in Airflow 4.0.
extra: dict[str, JsonValue]
# TODO: Deprecated in SDK in 3.2. Remove in Airflow 4.0.
extra: dict[str, JsonValue]

)
for watcher in watchers
],
# TODO: Deprecated in SDK. Remove in Airflow 4.0.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# TODO: Deprecated in SDK. Remove in Airflow 4.0.
# TODO: Deprecated in SDK in 3.2. Remove in Airflow 4.0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking this might be confusing if we decouple SDK and Core versioning.

Comment on lines 343 to +422
@@ -404,6 +407,20 @@ def normalized_uri(self) -> str | None:
except ValueError:
return None

@property
def extra(self) -> dict[str, JsonValue]:
# No warning here; a warning is shown when the value is set.
return self._extra

@extra.setter
def extra(self, value: dict[str, JsonValue]) -> None:
warnings.warn(
"Asset.extra is deprecated and will be removed in the future.",
RemovedInAirflow4Warning,
stacklevel=2,
)
self._extra = value
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No complaint but we use RemovedInAirflow4Warning and DeprecatedImportWarning randomly, so just flagging that here if that one's more relevant, but in this case since we know we want to nuke in AF4, I think we are OK?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I am not even sure when DeprecatedImportWarning should be used (I guess on imports…? And it also still implies removal on Airflow 4…?) But this is not supposed to be triggered on an import anyway so RemovedInAirflow4Warning is definitely the right one to use.

@kaxil kaxil requested a review from Copilot April 2, 2026 00:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate Asset.extra and add Asset.event_extra_template

4 participants