Skip to content

Add partition_key to Context #65340

Description

@m1racoli

Description

Add asset partitioning's partition_key to airflow.sdk.definitions.context.Context.

Use case/motivation

In asset partitioning the partition key replaces the role of the data interval. While CronPartitionTimetable doesn't have a data interval anymore, users who instead want to work with the partition key need to access the partition key via the task's dagrun:

# current
ctx = get_current_context()
ctx["dag_run"].partition_key

instead of directly accessing it via the context:

# proposed
ctx = get_current_context()
ctx["partition_key"]

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions