You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "romanzdk (via GitHub)" <gi...@apache.org> on 2023/11/06 14:43:13 UTC
[PR] Add usage withing jinja template [airflow]
romanzdk opened a new pull request, #35479:
URL: https://github.com/apache/airflow/pull/35479
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
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 an 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/
-->
<!-- Please keep an empty line above the dashes. -->
Add an example how to reference AWS connection in jinja template
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+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 a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #35479:
URL: https://github.com/apache/airflow/pull/35479#discussion_r1383535127
##########
docs/apache-airflow-providers-amazon/connections/aws.rst:
##########
@@ -240,6 +240,17 @@ With a AWS IAM key pair
"password": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}'
+Reference as Jinja templated fields
+^^^^^^^^^^^^^^^^^^^^^^^
+
+To render the AWS credentials using Jinja template reference ``AWS_ACCESS_KEY_ID`` as ``login`` and ``AWS_SECRET_ACCESS_KEY`` as ``password``
+
+ .. code-block:: bash
+
+ echo "AWS_ACCESS_KEY_ID={{ conn.connection_id.login }}"
+ echo "AWS_SECRET_ACCESS_KEY={{ conn.connection_id.password }}"
Review Comment:
Just for a reference it would only works in case if you use [long-term credentials](https://docs.aws.amazon.com/sdkref/latest/guide/access-iam-users.html) and it stored into the login / password fields
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "romanzdk (via GitHub)" <gi...@apache.org>.
romanzdk commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-1934953685
May I ask for merging this MR, 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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add usage withing jinja template [airflow]
Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #35479:
URL: https://github.com/apache/airflow/pull/35479#discussion_r1383601053
##########
docs/apache-airflow-providers-amazon/connections/aws.rst:
##########
@@ -240,6 +240,17 @@ With a AWS IAM key pair
"password": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}'
+Reference as Jinja templated fields
+^^^^^^^^^^^^^^^^^^^^^^^
+
+To render the AWS credentials using Jinja template reference ``AWS_ACCESS_KEY_ID`` as ``login`` and ``AWS_SECRET_ACCESS_KEY`` as ``password``
+
+ .. code-block:: bash
+
+ echo "AWS_ACCESS_KEY_ID={{ conn.connection_id.login }}"
+ echo "AWS_SECRET_ACCESS_KEY={{ conn.connection_id.password }}"
Review Comment:
Anyway it might be a good point to mentioned about relabelling however this affect not only an AWS Connection
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "romanzdk (via GitHub)" <gi...@apache.org>.
romanzdk commented on code in PR #35479:
URL: https://github.com/apache/airflow/pull/35479#discussion_r1384676673
##########
docs/apache-airflow-providers-amazon/connections/aws.rst:
##########
@@ -240,6 +240,17 @@ With a AWS IAM key pair
"password": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}'
+Reference as Jinja templated fields
+^^^^^^^^^^^^^^^^^^^^^^^
+
+To render the AWS credentials using Jinja template reference ``AWS_ACCESS_KEY_ID`` as ``login`` and ``AWS_SECRET_ACCESS_KEY`` as ``password``
+
+ .. code-block:: bash
+
+ echo "AWS_ACCESS_KEY_ID={{ conn.connection_id.login }}"
+ echo "AWS_SECRET_ACCESS_KEY={{ conn.connection_id.password }}"
Review Comment:
Info added
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #35479: Add usage withing jinja template
URL: https://github.com/apache/airflow/pull/35479
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #35479:
URL: https://github.com/apache/airflow/pull/35479#discussion_r1518580893
##########
docs/apache-airflow-providers-amazon/connections/aws.rst:
##########
@@ -240,6 +240,17 @@ With a AWS IAM key pair
"password": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}'
+Reference as Jinja templated fields
+^^^^^^^^^^^^^^^^^^^^^^^
Review Comment:
```suggestion
Reference as Jinja templated fields
^^^^^^^^^^^^^^^^^^^^^^^^^^
```
Fix static checks
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #35479:
URL: https://github.com/apache/airflow/pull/35479#discussion_r1383579316
##########
docs/apache-airflow-providers-amazon/connections/aws.rst:
##########
@@ -240,6 +240,17 @@ With a AWS IAM key pair
"password": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}'
+Reference as Jinja templated fields
+^^^^^^^^^^^^^^^^^^^^^^^
+
+To render the AWS credentials using Jinja template reference ``AWS_ACCESS_KEY_ID`` as ``login`` and ``AWS_SECRET_ACCESS_KEY`` as ``password``
+
+ .. code-block:: bash
+
+ echo "AWS_ACCESS_KEY_ID={{ conn.connection_id.login }}"
+ echo "AWS_SECRET_ACCESS_KEY={{ conn.connection_id.password }}"
Review Comment:
Yeah, in the UI it have this name because it relabelling in the Hook
https://github.com/apache/airflow/blob/5f4d2b5dee2e98a05124865c6fa855bc26d0af26/airflow/providers/amazon/aws/hooks/base_aws.py#L820-L823
All connections regardless of the conn_type have the same structure because you always retrieve `airflow.models.connection.Connection` object
https://github.com/apache/airflow/blob/f24e5199c793c48a2f8cf5fe6bb2699cd8283196/airflow/models/connection.py#L63-L84
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #35479: Add usage withing jinja template
URL: https://github.com/apache/airflow/pull/35479
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "ferruzzi (via GitHub)" <gi...@apache.org>.
ferruzzi commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-1989107090
May just be me, but I read this change and I have no idea where to put those two lines or how to use them.
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "romanzdk (via GitHub)" <gi...@apache.org>.
romanzdk commented on code in PR #35479:
URL: https://github.com/apache/airflow/pull/35479#discussion_r1383544951
##########
docs/apache-airflow-providers-amazon/connections/aws.rst:
##########
@@ -240,6 +240,17 @@ With a AWS IAM key pair
"password": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}'
+Reference as Jinja templated fields
+^^^^^^^^^^^^^^^^^^^^^^^
+
+To render the AWS credentials using Jinja template reference ``AWS_ACCESS_KEY_ID`` as ``login`` and ``AWS_SECRET_ACCESS_KEY`` as ``password``
+
+ .. code-block:: bash
+
+ echo "AWS_ACCESS_KEY_ID={{ conn.connection_id.login }}"
+ echo "AWS_SECRET_ACCESS_KEY={{ conn.connection_id.password }}"
Review Comment:
Actually I stored the values directly into `AWS Access Key ID` and `AWS Secret Access Key` and it worked with `login` and `password` template fields.

--
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: [PR] Add usage withing jinja template [airflow]
Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on code in PR #35479:
URL: https://github.com/apache/airflow/pull/35479#discussion_r1383601053
##########
docs/apache-airflow-providers-amazon/connections/aws.rst:
##########
@@ -240,6 +240,17 @@ With a AWS IAM key pair
"password": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}'
+Reference as Jinja templated fields
+^^^^^^^^^^^^^^^^^^^^^^^
+
+To render the AWS credentials using Jinja template reference ``AWS_ACCESS_KEY_ID`` as ``login`` and ``AWS_SECRET_ACCESS_KEY`` as ``password``
+
+ .. code-block:: bash
+
+ echo "AWS_ACCESS_KEY_ID={{ conn.connection_id.login }}"
+ echo "AWS_SECRET_ACCESS_KEY={{ conn.connection_id.password }}"
Review Comment:
Anyway it might be a good point to mentioned about relabelling and this affect not only an AWS Connection
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-1934973522
Well. You have docs and spellchecking failing. In order to merge PR it needs to be green.
Also merging it now when you are 1000 commits behind is risky, you should rebase it.
<img width="723" alt="Screenshot 2024-02-08 at 22 37 11" src="https://github.com/apache/airflow/assets/595491/4f536bae-e951-411d-916d-a3d78740e89e">
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-2144074036
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-1868144232
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-1794987731
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/main/CONTRIBUTING.rst)
Here are some useful points:
- Pay attention to the quality of your code (ruff, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/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/main/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/main/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/main/CONTRIBUTING.rst#coding-style-and-best-practices).
- Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add usage withing jinja template [airflow]
Posted by "romanzdk (via GitHub)" <gi...@apache.org>.
romanzdk commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-1875498412
Could someone merge this, 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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add usage withing jinja template [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-1875516020
BTW. It's up to author to remind and follow up if you see your PR is not merged (and especially when bot marks it as stalled) - it's far easier to do it for. you than for reviewers to monitor 170+ PRs that are on average open.
See some more information about it in - you are read a bit more about the review/merge process here https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#step-5-pass-pr-review
--
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: [PR] Add usage withing jinja template [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #35479:
URL: https://github.com/apache/airflow/pull/35479#issuecomment-1875511246
First
--
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