atul-astronomer opened a new issue, #47919:
URL: https://github.com/apache/airflow/issues/47919

   ### Apache Airflow version
   
   3.0.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   get_uri() is not implemented in connections.py in task sdk hence returning 
None and DAG is failing
   
   [2025-03-18, 16:31:07] INFO - URI:  None chan="stdout" source="task"
   
   [2025-03-18, 16:31:07] INFO - An assert is being made below that the uri is 
of type string chan="stdout" source="task"
   
   [2025-03-18, 16:31:07] ERROR - Task failed with exception source="task" 
error_detail=[{"exc_type":"AssertionError","exc_value":"","exc_notes":[],"syntax_error":null,"is_cause":false,"frames":[{"filename":"/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":606,"name":"run"},{"filename":"/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py","lineno":730,"name":"_execute_task"},{"filename":"/opt/airflow/task-sdk/src/airflow/sdk/definitions/baseoperator.py","lineno":373,"name":"wrapper"},{"filename":"/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py","lineno":196,"name":"execute"},{"filename":"/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py","lineno":220,"name":"execute_callable"},{"filename":"/opt/airflow/airflow/utils/operator_helpers.py","lineno":261,"name":"run"},{"filename":"/files/dags/connection_tests/test_uri_gen.py","lineno":55,"name":"check_uri_gen"}]}]
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   Create a conenction manually and run the belwo DAG:
   
   ```python
   def check_uri_gen():
       try:
           c = Connection()
           conn = c.get_connection_from_secrets(<connection_name>)
           uri = conn.get_uri()
           print("An assert is being made below that the uri is of type string")
           assert isinstance(uri, str)
           print(f"The uri is: {uri}")
           print("An assert is being made below that the get_uri() function of 
the Connection class is working correctly correctly")
           assert uri == 
"conn-type-string://username:password@dns_name.dns:33302/database_scheme"
       except AirflowRuntimeError:
           print("There is no connection to pull data from.")
   
   with DAG(
       dag_id=dag_name,
       start_date=datetime(2021, 1, 1),
       schedule=None,
       doc_md=docs,
       tags=["core", "connections"],
   ) as dag:
   
       t1 = PythonOperator(
           task_id="check_uri_generation",
           python_callable=check_uri_gen,
       )
   
   
   t1
   ``` 
   
   ### Operating System
   
   Linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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