You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ShousenZHANG (via GitHub)" <gi...@apache.org> on 2026/09/12 03:22:57 UTC

[PR] Add redis_conn_id to RedisKeySensor and RedisPubSubSensor template_fields [airflow]

ShousenZHANG opened a new pull request, #73018:
URL: https://github.com/apache/airflow/pull/73018

   Both Redis sensors take `redis_conn_id` and build the hook from it, but neither lists it in `template_fields`, so a Jinja connection id is never rendered:
   
   ```python
   sensor = RedisKeySensor(key="k", redis_conn_id="redis_{{ ds }}", task_id="t", dag=dag)
   sensor.render_template_fields({"ds": "2017-01-01"})
   sensor.redis_conn_id   # 'redis_{{ ds }}' on main, so the first poke raises
                          # AirflowNotFoundException
   ```
   
   `RedisPublishOperator` got this in #72883. These two sensors are the only other classes in the provider declaring `template_fields` — `AwaitMessageTrigger` is a `BaseTrigger` and gets rendered values — so this finishes the Redis slice of #35259.
   
   Not the no-op that closed #70638: that one was a no-op because `aws_template_fields()` already unions `aws_conn_id` in. Redis has no such helper, both tuples are plain literals, and neither `__init__` does anything but assign. @potiuk pointed at this case when closing it — the remaining work being in providers with no `aws_template_fields` equivalent.
   
   No test here: #72883 was submitted with one and the review was "This test is not needed", so it merged without. Glad to add them in the shape approved on #72582 if you'd prefer.
   
   Checked locally:
   
   - `pytest providers/redis/tests/unit/redis/` — `33 passed, 1 skipped`
   - `ruff check` / `ruff format --check` — clean
   - prek passes except `check-template-fields-valid`, which needs Breeze and won't run on the host. Ran the script it wraps directly instead — `scripts/in_container/run_template_fields_check.py` on both files, exit 0.
   
   Part of #35259.
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code
   
   Generated-by: Claude Code following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   I reviewed the change myself before opening 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.

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 redis_conn_id to RedisKeySensor and RedisPubSubSensor template_fields [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck merged PR #73018:
URL: https://github.com/apache/airflow/pull/73018


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