Skip to content

AIP-103: Refactor asset state routes to by-name/by-uri and add AssetUriRef support#66336

Merged
amoghrajesh merged 1 commit intoapache:mainfrom
astronomer:aip-103-2-extension-support-asset-with-uri
May 4, 2026
Merged

AIP-103: Refactor asset state routes to by-name/by-uri and add AssetUriRef support#66336
amoghrajesh merged 1 commit intoapache:mainfrom
astronomer:aip-103-2-extension-support-asset-with-uri

Conversation

@amoghrajesh
Copy link
Copy Markdown
Contributor

@amoghrajesh amoghrajesh commented May 4, 2026

This is a follow up to: #66073 to solve an inconsistency with the existing assets state API as it is today as pointed out in: #66160 (comment)

What changed:

Asset state routes were previously using a single set of endpoints with ?name= as the identifier. This had two problems:

  1. Asset.ref(uri="s3://...") inlets produce AssetUriRef objects which only have .uri, not .name — the task runner can crash at context construction time with AttributeError before user code ran

  2. The shape was inconsistent with how the existing /assets execution API works (/by-name and /by-uri as separate endpoints)

The routes are now split into /by-name/ and /by-uri/ sub-prefixes mirroring assets APIs.

GET/PUT/DELETE  /state/asset/by-name/value?name=<n>&key=<k>
DELETE          /state/asset/by-name/clear?name=<n>
GET/PUT/DELETE  /state/asset/by-uri/value?uri=<u>&key=<k>
DELETE          /state/asset/by-uri/clear?uri=<u>

Testing

By Name

  1. Using this DAG:
from airflow.sdk import DAG, Asset, task

MY_ASSET = Asset("test_events", uri="s3://data-lake/test-events")

with DAG("asset_dag", schedule=None) as dag:

    @task(outlets=[MY_ASSET])
    def produce():
        print("name=test_events  uri=s3://data-lake/test-events")

    produce()
  1. Pushed a asset state API
image
  1. Get API by name
image
  1. Delete API by name
image

By URI

  1. Pushed a asset state API with uri
image
  1. Get Asset event by uri
image
  1. Delete API by URI
image
Was generative AI tooling used to co-author this PR?
  • Yes : claude sonnet 4.6

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@amoghrajesh amoghrajesh merged commit 5b127b8 into apache:main May 4, 2026
141 checks passed
@amoghrajesh amoghrajesh deleted the aip-103-2-extension-support-asset-with-uri branch May 4, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:task-sdk

Projects

Development

Successfully merging this pull request may close these issues.

2 participants