Skip to content
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

Change weight priority type from Integer to Float #38160

Closed
wants to merge 1 commit into from

Conversation

Taragolis
Copy link
Contributor

Change task_instance.priority_weight type from int to float

Alternatives:


^ 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 newsfragments.

def downgrade():
"""Unapply change taskinstance priority weight type"""
with op.batch_alter_table("task_instance") as batch_op:
batch_op.alter_column("priority_weight", existing_type=sa.Float(), type_=sa.INTEGER())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case of overflow int32 (MySQL/Postgres) and presumably int64 in SQLite it will raise an error

Example of Postgres error

  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.DataError: (psycopg2.errors.NumericValueOutOfRange) integer out of range

[SQL: ALTER TABLE task_instance ALTER COLUMN priority_weight TYPE INTEGER ]
(Background on this error at: https://sqlalche.me/e/14/9h9h)

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we can prevent that easily - and I'd say it's an edge case of an edge-case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check on backend before save it into the DB 🤣

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

That indeed looks much simpler :)

@Taragolis Taragolis added the full tests needed We need to run full set of tests for this PR to merge label Mar 14, 2024
@Taragolis
Copy link
Contributor Author

That indeed looks much simpler :)

I have an opposite opinion about it

@Taragolis
Copy link
Contributor Author

Closed it should be implemented in top of the #38222
In addition changing type of weighted sum affects different parts, include executors.

@Taragolis Taragolis closed this Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full tests needed We need to run full set of tests for this PR to merge kind:documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants