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/08/29 07:23:51 UTC

[GitHub] [airflow] gbonazzoli opened a new issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

gbonazzoli opened a new issue #17889:
URL: https://github.com/apache/airflow/issues/17889


   ### Apache Airflow version
   
   2.1.3 (latest released)
   
   ### Operating System
   
   Ubuntu 20.04.3 LTS
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   LXD Container
   
   ### What happened
   
   If you write in a DAG:
   
   ```
                   Variable.set("BACKUP_ORACLE_PSDB_LAST_APPLIED_ARCH", p_event)
                   Variable.set("BACKUP_ORACLE_PSDB_LAST_APPLIED_DATETIME", p_timestamp)
   ```
   
   the Airflow Variables are successfuly set, but the descriptions are cleared away
   
   ### What you expected to happen
   
   I expect that the description is left untouched, and it is only updatable by the Airflow UI
   
   ### How to reproduce
   
   Create a Variable, give it a description, write 2 python lines of cod to update them.
   
   ```
   from airflow.models           import Variable
   Variable.set("BACKUP_ORACLE_PSDB_LAST_APPLIED_ARCH", "pippo")
   Variable.set("BACKUP_ORACLE_PSDB_LAST_APPLIED_DATETIME", "puluto")
   ```
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] ephraimbuddy commented on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908610678


   I like the first one: 
   ```python
   Variable.set(key, val, description=desc)  # description is optional.
   ```
   if we want it, I can work on it. Looks like there's a reason for the current design, will find out.
   
   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] ephraimbuddy edited a comment on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
ephraimbuddy edited a comment on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908348524


   I don't think this is a bug. There's a `setdefault` method you can use for the behaviour you want above and not `set`.
   @ashb


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr edited a comment on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
uranusjr edited a comment on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908362019


   The weird thing is there is no API to set the value _with_ description. Maybe we should have
   
   ```python
   Variable.set(key, val, description=desc)  # description is optional.
   Variable.update(key, value)  # Keeps description. Only works if there is a variable matching key?
   ```


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr commented on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908362019


   The weird thing is there is no API to set the value _with_ description. Maybe we should have
   
   ```python
   Variable.set(key, val, description=desc)  # description is optional.
   Variable.update(key, value)  # Only works if there is a variable matching key?
   ```


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr edited a comment on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
uranusjr edited a comment on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908362019


   The weird thing is there is no API to set the value _with_ description. Maybe we should have
   
   ```python
   Variable.set(key, val, description=desc)  # description is optional.
   Variable.update(key, value)  # Keeps description. Only works if there is a variable matching key?
   ```


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] ashb commented on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
ashb commented on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-911585247


   Variables didn't use to have descriptions, and when someone added it via the UI they forgot about the python API.
   
   The interface uranusjr  proposes looks like a good one.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] ephraimbuddy commented on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908348524


   I don't think this is a bug. There's a `setdefault` method you can use for the behaviour you want above and not `set`.
   @ash


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] kaxil commented on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-922144340


   Closed by https://github.com/apache/airflow/pull/18159


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] ephraimbuddy commented on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908348524






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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] kaxil closed issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
kaxil closed issue #17889:
URL: https://github.com/apache/airflow/issues/17889


   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] ephraimbuddy removed a comment on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
ephraimbuddy removed a comment on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908610678


   I like the first one: 
   ```python
   Variable.set(key, val, description=desc)  # description is optional.
   ```
   if we want it, I can work on it. Looks like there's a reason for the current design, will find out.
   
   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] ephraimbuddy edited a comment on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
ephraimbuddy edited a comment on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908348524


   I don't think this is a bug. There's a `setdefault` method you can use for the behaviour you want above and not `set`.
   @ashb


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] ephraimbuddy removed a comment on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
ephraimbuddy removed a comment on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908610678


   I like the first one: 
   ```python
   Variable.set(key, val, description=desc)  # description is optional.
   ```
   if we want it, I can work on it. Looks like there's a reason for the current design, will find out.
   
   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr commented on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-908362019


   The weird thing is there is no API to set the value _with_ description. Maybe we should have
   
   ```python
   Variable.set(key, val, description=desc)  # description is optional.
   Variable.update(key, value)  # Only works if there is a variable matching key?
   ```


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] SamWheating commented on issue #17889: Airflow 2.1.3 Variable.set(name, value) statement clears out Variable Description inserted in Airflow UI

Posted by GitBox <gi...@apache.org>.
SamWheating commented on issue #17889:
URL: https://github.com/apache/airflow/issues/17889#issuecomment-912039643


   I can put together a PR for this if you want to assign this one to me. 


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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