You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/04 21:25:08 UTC

[GitHub] [airflow] itroulli opened a new pull request #15194: Adds description field in variable (#12413)

itroulli opened a new pull request #15194:
URL: https://github.com/apache/airflow/pull/15194


   Closes #12413 
   
   This is my first PR. I tried to follow the [CONTRIBUTING](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst) 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 an `input class` but I wasn't able to find a way to do it. Any advice on that will be appreciated. 
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang edited a comment on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang edited a comment on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-816926943


   @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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-816951557


   > @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!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r611235025



##########
File path: airflow/models/variable.py
##########
@@ -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))

Review comment:
       This is the most recent change https://github.com/apache/airflow/pull/15203




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r611813906



##########
File path: airflow/models/variable.py
##########
@@ -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)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
-    def __init__(self, key=None, val=None):
+    def __init__(self, key=None, val=None, description=None):
         super().__init__()
         self.key = key
         self.val = val
+        self.description = description

Review comment:
       @kaxil Since this is a feature only viewable/editable from the UI, what tests would you suggest? Just including the description field in [this line](https://github.com/apache/airflow/blob/master/tests/www/test_views.py#L275) would suffice? 
   Thanks in advance!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r614127486



##########
File path: airflow/models/variable.py
##########
@@ -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)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
-    def __init__(self, key=None, val=None):
+    def __init__(self, key=None, val=None, description=None):
         super().__init__()
         self.key = key
         self.val = val
+        self.description = description

Review comment:
       That is debatable :) -- but anyways for now you could just do `session.query(Variable.key, Variable.description).first()` and just verify that




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r610389678



##########
File path: airflow/models/variable.py
##########
@@ -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(String(5000))

Review comment:
       ```suggestion
       description = Column(Text(5000))
   ```
   
   This will give you `textarea` instead of `input`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r614724786



##########
File path: airflow/models/variable.py
##########
@@ -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)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
-    def __init__(self, key=None, val=None):
+    def __init__(self, key=None, val=None, description=None):
         super().__init__()
         self.key = key
         self.val = val
+        self.description = description

Review comment:
       I've created #15400. Thanks again!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r614435591



##########
File path: airflow/models/variable.py
##########
@@ -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)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
-    def __init__(self, key=None, val=None):
+    def __init__(self, key=None, val=None, description=None):
         super().__init__()
         self.key = key
         self.val = val
+        self.description = description

Review comment:
       Yup : )




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r610383326



##########
File path: airflow/models/variable.py
##########
@@ -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(String(5000))

Review comment:
       ```suggestion
       description = Column(Text(5000))
   ```
   
   This will render `textarea` instead of `input` for you




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang merged pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang merged pull request #15194:
URL: https://github.com/apache/airflow/pull/15194


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-817910840


   @itroulli  Thank you so much for the PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r610850423



##########
File path: airflow/www/views.py
##########
@@ -3145,9 +3145,9 @@ class VariableModelView(AirflowModelView):
         permissions.ACTION_CAN_ACCESS_MENU,
     ]
 
-    list_columns = ['key', 'val', 'is_encrypted']
-    add_columns = ['key', 'val']
-    edit_columns = ['key', 'val']
+    list_columns = ['key', 'val', 'description', 'is_encrypted']
+    add_columns = ['key', 'val', 'description']
+    edit_columns = ['key', 'val', 'description']

Review comment:
       My thought was that since the description field is option it is better to be after the required ones. I can change it though, if you prefer it to be second.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kurtqq commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
kurtqq commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-813640621


   thanks @itroulli !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-816417491


   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r613970264



##########
File path: airflow/models/variable.py
##########
@@ -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)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
-    def __init__(self, key=None, val=None):
+    def __init__(self, key=None, val=None, description=None):
         super().__init__()
         self.key = key
         self.val = val
+        self.description = description

Review comment:
       @kaxil The thing is that following @kurtqq 's suggestion in [the issue](https://github.com/apache/airflow/issues/12413#issuecomment-809671348), I didn't modify the `Variable.get` method so it won't return the description. 
   
   I may be missing something though, let me know what do you think.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-813101717


   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)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, pylint and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/master/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/master/BREEZE.rst) for testing locally, itโ€™s a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better ๐Ÿš€.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r610928136



##########
File path: airflow/models/variable.py
##########
@@ -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))

Review comment:
       ```suggestion
       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 :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r610383909



##########
File path: airflow/www/views.py
##########
@@ -3145,9 +3145,9 @@ class VariableModelView(AirflowModelView):
         permissions.ACTION_CAN_ACCESS_MENU,
     ]
 
-    list_columns = ['key', 'val', 'is_encrypted']
-    add_columns = ['key', 'val']
-    edit_columns = ['key', 'val']
+    list_columns = ['key', 'val', 'description', 'is_encrypted']
+    add_columns = ['key', 'val', 'description']
+    edit_columns = ['key', 'val', 'description']

Review comment:
       Do you think it'll be better to order as `['key', 'description', 'val',`? This seems to be a more reasonable order




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r611840966



##########
File path: airflow/models/variable.py
##########
@@ -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)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
-    def __init__(self, key=None, val=None):
+    def __init__(self, key=None, val=None, description=None):
         super().__init__()
         self.key = key
         self.val = val
+        self.description = description

Review comment:
       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




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-817910444


   Awesome work, congrats on your first merged pull request!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-817372023






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r610383326



##########
File path: airflow/models/variable.py
##########
@@ -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(String(5000))

Review comment:
       ```suggestion
       description = Column(Text(5000))
   ```
   
   This will render `textarea` instead of `input` for you




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r610857758



##########
File path: airflow/www/views.py
##########
@@ -3145,9 +3145,9 @@ class VariableModelView(AirflowModelView):
         permissions.ACTION_CAN_ACCESS_MENU,
     ]
 
-    list_columns = ['key', 'val', 'is_encrypted']
-    add_columns = ['key', 'val']
-    edit_columns = ['key', 'val']
+    list_columns = ['key', 'val', 'description', 'is_encrypted']
+    add_columns = ['key', 'val', 'description']
+    edit_columns = ['key', 'val', 'description']

Review comment:
       Let's keep it as it's now. `Pool` model is using the same order




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-814117726


   Thank you @kurtqq for the guidance! If you have any suggestion on how to make the field a `textarea` one, let me know!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r611234529



##########
File path: airflow/models/variable.py
##########
@@ -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))

Review comment:
       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`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r611804787



##########
File path: airflow/models/variable.py
##########
@@ -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)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
-    def __init__(self, key=None, val=None):
+    def __init__(self, key=None, val=None, description=None):
         super().__init__()
         self.key = key
         self.val = val
+        self.description = description

Review comment:
       Can we add some tests for this feature please




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r614421412



##########
File path: airflow/models/variable.py
##########
@@ -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)
     is_encrypted = Column(Boolean, unique=False, default=False)
 
-    def __init__(self, key=None, val=None):
+    def __init__(self, key=None, val=None, description=None):
         super().__init__()
         self.key = key
         self.val = val
+        self.description = description

Review comment:
       Thanks a lot for the tips! I rebased, implemented it and pushed in my branch but I guess a new PR is needed, right?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-817371948


   [The Workflow run](https://github.com/apache/airflow/actions/runs/739023826) 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*.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#issuecomment-816926943


   @itroulli  I help rebase the branch because any changes in the migration folder require to rebase on the latest master. Once CI passed, I will merge it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r610850586



##########
File path: airflow/models/variable.py
##########
@@ -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(String(5000))

Review comment:
       Perfect! Thanks a lot!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] xinbinhuang commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
xinbinhuang commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r611234529



##########
File path: airflow/models/variable.py
##########
@@ -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))

Review comment:
       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, there are two ways of doing this:
   
   - manually change the `down_revision` number to the latest revision number in `master` branch
   - delete the revision file and regenerate it after rebase to `master` (I personally do this.)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r611201878



##########
File path: airflow/models/variable.py
##########
@@ -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))

Review comment:
       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'`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] itroulli commented on a change in pull request #15194: Adds description field in variable (#12413)

Posted by GitBox <gi...@apache.org>.
itroulli commented on a change in pull request #15194:
URL: https://github.com/apache/airflow/pull/15194#discussion_r611478445



##########
File path: airflow/models/variable.py
##########
@@ -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))

Review comment:
       Seems that everything is passing now! :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org