-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Adds description field in variable (#12413) #15194
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
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
|
thanks @itroulli ! |
Thank you @kurtqq for the guidance! If you have any suggestion on how to make the field a |
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.
LGTM
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
bf7fa19
to
d97e70d
Compare
@itroulli I help rebase the branch because any changes in the migration folder require to rebase on the latest master before merging. Once CI passed, I will merge it |
Thanks a lot for the help! I appreciate it! |
airflow/models/variable.py
Outdated
@@ -47,12 +47,14 @@ class Variable(Base, LoggingMixin): | |||
id = Column(Integer, primary_key=True) | |||
key = Column(String(ID_LEN), unique=True) | |||
_val = Column('val', Text) | |||
description = Column(Text(5000)) |
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.
description = Column(Text(5000)) | |
description = Column(Text) |
@itroulli sorry for the confusion. Postgres doesn't allow modifier on text
field. Can you also update this and the alembic migration file? (you would need to git pull
the branch first) Let me know if you have any questions :)
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 think I'd need some help with updating the revision keys in the migration file. I believe this is why some checks are failing. With Python 3.6, MySQL 5.7 right now I get this error:
alembic.util.exc.CommandError: Can't locate revision identified by '458c2838cbca'
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.
Hmm, this is because there are other migration changes merged to the master before you, which happens sometimes given the number of PRs we have. We used to have problems with multiple diverge alembic heads, and we mitigate it by making sure that any PR affecting the migration
folder will need to rebase on the latest master. So, to fix it, I normally delete the revision file and regenerate it after rebase to master
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.
This is the most recent change #15203
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.
Seems that everything is passing now! :)
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
Co-authored-by: itroulli
Awesome work, congrats on your first merged pull request! |
@itroulli Thank you so much for the PR! |
def __init__(self, key=None, val=None, description=None): | ||
super().__init__() | ||
self.key = key | ||
self.val = val | ||
self.description = description |
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.
Can we add some tests for this feature please
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.
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.
Probably just a separate test in that file, the simply tests that you can set description to a variable, which is peristed to db and when you do Variable.get
you get the same description field
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.
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 is debatable :) -- but anyways for now you could just do session.query(Variable.key, Variable.description).first()
and just verify that
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.
Thanks a lot for the tips! I rebased, implemented it and pushed in my branch but I guess a new PR is needed, right?
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.
Yup : )
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've created #15400. Thanks again!
Closes #12413
This is my first PR. I tried to follow the CONTRIBUTING guide step by step. It passed all the pre-commit tests.
My PR adds a description field for the Airflow variables that can only be set and seen trhough the UI. Also, I would prefer to have created a
textarea class
instead of aninput class
but I wasn't able to find a way to do it. Any advice on that will be appreciated.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.