Skip to content

make bundle_name not nullable #47592

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

Open
wants to merge 90 commits into
base: main
Choose a base branch
from
Open

make bundle_name not nullable #47592

wants to merge 90 commits into from

Conversation

gyli
Copy link
Collaborator

@gyli gyli commented Mar 11, 2025

Change bundle_name in dag not nullable and prepopulate the value in the migration: #46734

Closes: #46734

@boring-cyborg boring-cyborg bot added the area:db-migrations PRs with DB migration label Mar 11, 2025
remove migration query

Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
@gyli gyli requested a review from potiuk as a code owner March 15, 2025 22:24
@gyli
Copy link
Collaborator Author

gyli commented May 5, 2025

Hi @ephraimbuddy @jedcunningham Do you think this PR looks good already, or you think more testing needs to be done?

@ephraimbuddy
Copy link
Contributor

Hi @ephraimbuddy @jedcunningham Do you think this PR looks good already, or you think more testing needs to be done?

Since Airflow 3 has been released, we should update the PR with new migration file instead of editing the add-dagbundlemodel migration file. Sorry that it didn't make it to 3.0.0

@gyli
Copy link
Collaborator Author

gyli commented May 6, 2025

PR is updated to use new migration file, as 3.0 is rolled out.

…undle_name_not_nullable.py

Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
…undle_name_not_nullable.py


Update downgrade

Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
@gyli
Copy link
Collaborator Author

gyli commented Jul 15, 2025

@jedcunningham @eladkal Conflict is resolved, could you please review again? Thanks!

@gyli
Copy link
Collaborator Author

gyli commented Jul 19, 2025

Hi @jedcunningham, PR updated. All test functions now add dag bundle with fixture. For adding dag bundle in helper functions, DagBundleModel is still used to avoid creating dag bundle unnecessarily. Does it look good to you?

dag_id = "dag_with_queued_run"

# Create DagModel
dag_model = DagModel(
dag_id=dag_id,
bundle_name="testing",
Copy link
Member

Choose a reason for hiding this comment

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

Would testing_dag_bundle.name be better?

Copy link
Member

Choose a reason for hiding this comment

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

That fixture doesnt return the model, but it could. My 2c, we have so much of this pattern already, keeping consistent and refactoring separately, if we wanted to, would be the way to go.

Comment on lines +1866 to +1867
if AIRFLOW_V_3_0_PLUS:
clear_db_dag_bundles()
Copy link
Member

Choose a reason for hiding this comment

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

This should use AIRFLOW_V_3_1_PLUS instead (since 3.0.x would not have this function)

Copy link
Collaborator Author

@gyli gyli Jul 29, 2025

Choose a reason for hiding this comment

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

By checking the function definition and the migration file of DagBundle, I think the function and the model exist with 3.0.x.
Actually, AIRFLOW_V_3_0_PLUG is used as the condition for clear_db_dag_bundles in other places as well, like here.

Copy link
Member

Choose a reason for hiding this comment

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

Why are these fixtures no longer class scoped?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is because function scope fixture testing_dag_bundle is used here. If they are class scoped, it will raise error ScopeMismatch: You tried to access the function scoped fixture testing_dag_bundle with a class scoped request object.
I think switching to function scoped is easier, compared to creating bundle with DagBundleModel.

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

Successfully merging this pull request may close these issues.

Make bundle_name non-nullable
5 participants