Content-Length: 361407 | pFad | http://github.com/apache/airflow/pull/50852

92 Fix bulk action annotation by guan404ming · Pull Request #50852 · apache/airflow · GitHub
Skip to content

Fix bulk action annotation #50852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

guan404ming
Copy link
Contributor

@guan404ming guan404ming commented May 20, 2025

Why

The type annotations for bulk action are incorrect, which is found when I dig into tracing ci error in #50443. I think this is independent thus split this from that one.

How

I update the action type with default value. This would affect bulk connection, variable and pool.

before (example value show on swagger)

{
  "actions": [
    {
      "action": "create",
      "entities": [
        {
          "connection_id": "RaWlyerMwZB4HWkvpQ",
          "conn_type": "string",
          "description": "string",
          "host": "string",
          "login": "string",
          "schema": "string",
          "port": 0,
          "password": "string",
          "extra": "string"
        }
      ],
      "action_on_existence": "fail"
    },
    {
      "action": "create",
      "entities": [
        {
          "connection_id": "qWspL.KI..EomTj-Z003JLNXUZ-c2iEB5y8OhfvShMBg",
          "conn_type": "string",
          "description": "string",
          "host": "string",
          "login": "string",
          "schema": "string",
          "port": 0,
          "password": "string",
          "extra": "string"
        }
      ],
      "action_on_non_existence": "fail"
    },
    {
      "action": "create",
      "entities": [
        "string"
      ],
      "action_on_non_existence": "fail"
    }
  ]
}

after (example value show on swagger)

{
  "actions": [
    {
      "action": "create",
      "entities": [
        {
          "connection_id": "X_yo6QuSl9u4HVXxB9YNy.mHdmnNzcPCVjy3Fa9D2IHrwY7tkvlX",
          "conn_type": "string",
          "description": "string",
          "host": "string",
          "login": "string",
          "schema": "string",
          "port": 0,
          "password": "string",
          "extra": "string"
        }
      ],
      "action_on_existence": "fail"
    },
    {
      "action": "update",
      "entities": [
        {
          "connection_id": "8sJhEpjO6-Ey9IyPGjL448pqIXIIu3bo9Vy4Sy1q2NoL5WS3bwNT2x6",
          "conn_type": "string",
          "description": "string",
          "host": "string",
          "login": "string",
          "schema": "string",
          "port": 0,
          "password": "string",
          "extra": "string"
        }
      ],
      "action_on_non_existence": "fail"
    },
    {
      "action": "delete",
      "entities": [
        "string"
      ],
      "action_on_non_existence": "fail"
    }
  ]
}

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels May 20, 2025
@guan404ming guan404ming changed the title Fix bulk api annotation Fix bulk action annotation May 20, 2025
@guan404ming guan404ming force-pushed the fix-bulk-api-annotation branch 3 times, most recently from bf6f3ef to 22f6aba Compare May 21, 2025 14:14
@guan404ming guan404ming marked this pull request as ready for review May 21, 2025 14:14
Copy link
Contributor

@bugraoz93 bugraoz93 left a comment

Choose a reason for hiding this comment

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

Thanks a lot! Looks good overall! Small question :)

@@ -66,20 +66,29 @@ class BulkBaseAction(StrictBaseModel, Generic[T]):
class BulkCreateAction(BulkBaseAction[T]):
"""Bulk Create entity serializer for request bodies."""

action: BulkAction = Field(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we allow other fields? Maybe it is good to add Literal here and only allow the action itself to create, upsate, or delete.
What do you think?

Copy link
Contributor Author

@guan404ming guan404ming May 21, 2025

Choose a reason for hiding this comment

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

It does makes sense to update it with Literal but I got some type error Type arguments for "Literal" must be None, a literal value (int, bool, str, or bytes), or an enum value when passing enum value to Literal. Thus, I added type: ignore for it. Not sure the current version is the best practice or not. Please take another look and let me know if any modification needed, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CI still have some error, mark it as draft.

@guan404ming guan404ming force-pushed the fix-bulk-api-annotation branch from 22f6aba to 19a8208 Compare May 21, 2025 19:41
@guan404ming guan404ming marked this pull request as draft May 21, 2025 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/apache/airflow/pull/50852

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy