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

    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull 
request.
   Write a good git commit message following this guide: 
http://chris.beams.io/posts/git-commit/
   
   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 (in general) for the review if you do not see reaction for 
a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we 
sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change below checkbox to `[X]` followed by the name of the tool, uncomment 
the "Generated-by".
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name] following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   
   Fix for CI like: 
https://github.com/apache/airflow/actions/runs/26391986239/job/77689459612?pr=67460
 and in main too
   
   ## Current behaviour
   
   `pymysql 1.2.0` changed the default of `Connection.ping(reconnect)` from 
`True` to `False`.
   SQLAlchemy's `_send_false_to_ping` memoized property inspects this signature 
— when it sees
   `reconnect=False` it switches to calling `dbapi_connection.ping()` with no 
arguments. 
   
   But SQLAlchemy's `AsyncAdapt_aiomysql_connection.ping(self, reconnect: 
bool)` has no default for
   `reconnect`, so the bare call raises a `TypeError` every time the async 
connection pool runs a
   pre-ping health check (`pool_pre_ping=True`).
   
   Error looks like this:
   
   ```shell
   
_____________________________________________________________________________________
 TestSession.test_async_session 
_____________________________________________________________________________________
   airflow-core/tests/unit/utils/test_session.py:66: in test_async_session
       my_special_log_event = await session.scalar(select(Log).where(Log.event 
== "hihi1234").limit(1))
   
/usr/python/lib/python3.10/site-packages/sqlalchemy/ext/asyncio/session.py:505: 
in scalar
       return await greenlet_spawn(
   
/usr/python/lib/python3.10/site-packages/sqlalchemy/util/_concurrency_py3k.py:203:
 in greenlet_spawn
       result = context.switch(value)
   /usr/python/lib/python3.10/site-packages/sqlalchemy/orm/session.py:2399: in 
scalar
       return self._execute_internal(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/orm/session.py:2239: in 
_execute_internal
       conn = self._connection_for_bind(bind)
   /usr/python/lib/python3.10/site-packages/sqlalchemy/orm/session.py:2108: in 
_connection_for_bind
       return trans._connection_for_bind(engine, execution_options)
   <string>:2: in _connection_for_bind
       ???
   
/usr/python/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py:137: 
in _go
       ret_value = fn(self, *arg, **kw)
   /usr/python/lib/python3.10/site-packages/sqlalchemy/orm/session.py:1187: in 
_connection_for_bind
       conn = bind.connect()
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:3293: in 
connect
       return self._connection_cls(self)
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:143: in 
__init__
       self._dbapi_connection = engine.raw_connection()
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/base.py:3317: in 
raw_connection
       return self.pool.connect()
   /usr/python/lib/python3.10/site-packages/sqlalchemy/pool/base.py:448: in 
connect
       return _ConnectionFairy._checkout(self)
   /usr/python/lib/python3.10/site-packages/sqlalchemy/pool/base.py:1371: in 
_checkout
       with util.safe_reraise():
   /usr/python/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py:121: 
in __exit__
       raise exc_value.with_traceback(exc_tb)
   /usr/python/lib/python3.10/site-packages/sqlalchemy/pool/base.py:1309: in 
_checkout
       result = pool._dialect._do_ping_w_event(
   /usr/python/lib/python3.10/site-packages/sqlalchemy/engine/default.py:729: 
in _do_ping_w_event
       return self.do_ping(dbapi_connection)
   
/usr/python/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/pymysql.py:123:
 in do_ping
       dbapi_connection.ping()
   E   TypeError: AsyncAdapt_aiomysql_connection.ping() missing 1 required 
positional argument: 'reconnect'
   ```
   
   ## Solution
   
   Cap `pymysql<1.2` in the mysql provider's dependencies until SQLAlchemy's 
aiomysql adapter is
   updated to handle the new signature.
   
   
   
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


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

Reply via email to