You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "thoniTUB (via GitHub)" <gi...@apache.org> on 2026/02/05 09:48:51 UTC
[I] Import List Value vor Variable [airflow]
thoniTUB opened a new issue, #61490:
URL: https://github.com/apache/airflow/issues/61490
### Apache Airflow version
3.1.7
### If "Other Airflow 3 version" selected, which one?
_No response_
### What happened?
I strumbled on this inconsistency:
#### Not Working: Create Variable with CLI Import
I cannot import this variable from a file using the cli command `airflow variables import variables.json`:
```yaml
# variables.json
{
"var1": [
{
"foo": "bar"
},
{
"bar": "foo"
}
]
}
```
It fails with the message:
> The "variables.json" file contains multiple values for keys: ['var1']
#### Working: Create Variable using the UI
I can however create this variable in the UI.
Then I can use `airflow variables export variables.json` to dump the very same JSON as above, which cannot be imported again.
### What you think should happen instead?
[The code here](https://github.com/apache/airflow/blob/8f3ae04f89e4679c02b4a2500557cf46863af854/airflow-core/src/airflow/secrets/local_filesystem.py#L247) blocks this import of a list value with more than 1 item.
However, it does not explain why a list with multiple elements is not allowed here.
### How to reproduce
Start a airflow instance and do the steps described above.
### Operating System
RHEL 9
### Versions of Apache Airflow Providers
_No response_
### Deployment
Virtualenv installation
### Deployment details
poetry managed env and a `airflow standalone` instance
### Anything else?
_No response_
### Are you willing to submit PR?
- [x] 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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Import List Value vor Variable [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #61490:
URL: https://github.com/apache/airflow/issues/61490#issuecomment-3852368557
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
--
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
Re: [I] Import List Value with multilpe Items for Variable [airflow]
Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on issue #61490:
URL: https://github.com/apache/airflow/issues/61490#issuecomment-3853804039
@abhijeets25012-tech - please feel free to open a PR for this issue. I'd take a look at this line of code in the link that @thoniTUB sent.
```python
invalid_keys = [key for key, values in secrets.items() if isinstance(values, list) and len(values) != 1]
```
--
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
Re: [I] Import List Value with multilpe Items for Variable [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #61490: Import List Value with multilpe Items for Variable
URL: https://github.com/apache/airflow/issues/61490
--
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
Re: [I] Import List Value with multilpe Items for Variable [airflow]
Posted by "abhijeets25012-tech (via GitHub)" <gi...@apache.org>.
abhijeets25012-tech commented on issue #61490:
URL: https://github.com/apache/airflow/issues/61490#issuecomment-3853688394
i would like to contribute
--
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
Re: [I] Import List Value with multilpe Items for Variable [airflow]
Posted by "thoniTUB (via GitHub)" <gi...@apache.org>.
thoniTUB commented on issue #61490:
URL: https://github.com/apache/airflow/issues/61490#issuecomment-3854028168
@jroachgolf84 The variable in the UI looks like this:
<img width="895" height="443" alt="Image" src="https://github.com/user-attachments/assets/3908ab7f-bfa4-4fe6-8c8f-16d09061ed63" />
And in the code it comes to this (not using `airflow.sdk.Variable` yet):
```python
from airflow.models import Variable
... = Variable.get("var1", deserialize_json=deserialize_json)
```
--
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
Re: [I] Import List Value with multilpe Items for Variable [airflow]
Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on issue #61490:
URL: https://github.com/apache/airflow/issues/61490#issuecomment-3853808227
@thoniTUB - what does the Variable look like once you've created it in the UI? How are you parsing it in your code?
--
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
Re: [I] Import List Value with multilpe Items for Variable [airflow]
Posted by "liamkernan (via GitHub)" <gi...@apache.org>.
liamkernan commented on issue #61490:
URL: https://github.com/apache/airflow/issues/61490#issuecomment-3861929896
Hi, I'd like to work on this issue.
The problem is in `load_variables()` in `airflow-core/src/airflow/secrets/local_filesystem.py`. The function uses `isinstance(values, list)` to check for duplicate keys, but this check was designed for `.env` files where the parser wraps values in lists when a key appears multiple times. For JSON and YAML files, list values are legitimate variable values — not indicators of duplicate keys.
I'll submit a PR shortly that fixes this by only applying the duplicate-key check for `.env` files, and passing through JSON/YAML values as-is.
--
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
Re: [I] Import List Value with multilpe Items for Variable [airflow]
Posted by "shashbha14 (via GitHub)" <gi...@apache.org>.
shashbha14 commented on issue #61490:
URL: https://github.com/apache/airflow/issues/61490#issuecomment-3866806718
take
--
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