-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Conversation
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()) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 🤣
There was a problem hiding this 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 :)
851d677
to
da97cfb
Compare
I have an opposite opinion about it |
Closed it should be implemented in top of the #38222 |
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.