amoghrajesh opened a new issue, #52520:
URL: https://github.com/apache/airflow/issues/52520

   ### Body
   
   During the migration of BaseHook to task sdk, we are introducing a temporary 
workaround in the API server context: 
   
https://github.com/apache/airflow/pull/51873/files#diff-acfa34467241916c1189174e98f87a4094e8cbf58d391fa084e6afb2594decbcR61-R71
 to help solve some compat issues which arrived along the way.
   
   When in the API server context, the system uses the Connection model (via 
custom backend > env var > DB fallback) directly.
   
   This unblocks the bulk of the BaseHook removal work, but it’s not the ideal 
long-term solution. We should revisit this approach to avoid leaking this 
shortcut into 3.1 release.
   
   This issue is dependent on coupling between Git bundle and API server. For 
`view_url` use case, a slim git bundle is instantiated to form the view_url 
leading to it using BaseHook to get a connection and BaseHook uses `Connection` 
from SDK, it goes back to API server causing a self loop scenario.
   
   ```
   ../../.venv/lib/python3.12/site-packages/pydantic/type_adapter.py:572: in 
dump_python
       return self.serializer.to_python(
   ../src/airflow/api_fastapi/core_api/datamodels/dag_versions.py:45: in 
bundle_url
       return DagBundlesManager().view_url(self.bundle_name, 
self.bundle_version)
   ../src/airflow/dag_processing/bundles/manager.py:168: in view_url
       bundle = self.get_bundle(name, version)
   ../src/airflow/dag_processing/bundles/manager.py:156: in get_bundle
       return class_(name=name, version=version, **kwargs)
   ../../providers/git/src/airflow/providers/git/bundles/git.py:88: in __init__
       self.hook = GitHook(git_conn_id=git_conn_id)
   ../../providers/git/src/airflow/providers/git/hooks/git.py:73: in __init__
       connection = self.get_connection(git_conn_id)
   ../../task-sdk/src/airflow/sdk/bases/hook.py:61: in get_connection
       conn = Connection.get(conn_id)
   ../../task-sdk/src/airflow/sdk/definitions/connection.py:152: in get
       return _get_connection(conn_id)
   ../../task-sdk/src/airflow/sdk/execution_time/context.py:162: in 
_get_connection
       return _convert_connection_result_conn(msg)
   ../../task-sdk/src/airflow/sdk/execution_time/context.py:108: in 
_convert_connection_result_conn
       return Connection(**conn_result.model_dump(exclude={"type"}, 
by_alias=True))
   E   TypeError: Connection.__init__() missing 2 required positional 
arguments: 'conn_id' and 'conn_type'
   ```
   
   
   
   ### Committer
   
   - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


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