Codingaditya17 opened a new pull request, #67906:
URL: https://github.com/apache/airflow/pull/67906
Closes: #67893
### Approach
This PR keeps the change focused on the Snowflake SQL API async path, which
is one of the affected deferrable operator paths mentioned in the issue.
The change adds a new `[aiohttp] trust_env` Airflow config option with a
default value of `false`. The Snowflake SQL API hook reads this config and
includes it in the default `aiohttp_session_kwargs` used when creating
`aiohttp.ClientSession`.
Explicitly provided `aiohttp_session_kwargs` still take precedence, so users
can override the global config at the hook level when needed.
This PR also passes `aiohttp_session_kwargs` through
`SnowflakeSqlApiTrigger` serialization. Without this, the operator could create
the hook with async session options, but the deferrable triggerer path would
lose those options when recreating the hook during polling.
### What changed
- Added `[aiohttp] trust_env` config support.
- Applied the configured `trust_env` value in `SnowflakeSqlApiHook`.
- Passed `aiohttp_session_kwargs` from `SnowflakeSqlApiOperator` into
`SnowflakeSqlApiTrigger`.
- Serialized `aiohttp_session_kwargs` in the trigger so the triggerer
preserves async session options.
- Added tests for config based `trust_env`, trigger serialization, trigger
hook creation, and operator deferral.
### Tested
```bash
uv run ruff check \
providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake_sql_api.py \
providers/snowflake/src/airflow/providers/snowflake/operators/snowflake.py
\
providers/snowflake/src/airflow/providers/snowflake/triggers/snowflake_trigger.py
\
providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py \
providers/snowflake/tests/unit/snowflake/operators/test_snowflake.py \
providers/snowflake/tests/unit/snowflake/triggers/test_snowflake.py
uv run pytest
providers/snowflake/tests/unit/snowflake/triggers/test_snowflake.py
uv run pytest
providers/snowflake/tests/unit/snowflake/operators/test_snowflake.py::TestSnowflakeSqlApiOperator
uv run pytest
providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py -k
"aiohttp_session_kwargs or trust_env or async"
uv run pytest airflow-core/tests/unit/core/test_configuration.py -k
"default_config or config"
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]