GitHub user potiuk added a comment to the discussion: Is it possible to use a 
Connection stored in the metadata DB from a python shell

Generally - in Airflow 3 - see 
https://airflow.apache.org/docs/apache-airflow/stable/release_notes.html#airflow-3-0-0-2025-04-22
 -  you are not allowed to use direct DB connection from worker. Your worker is 
not supposed to connect to the database at all - it uses execution API to 
retrieve the connection, This is part of the new architecture of Airflow. 

So it really depends where and in what context you start the shell. If you 
start it on scheduler, I think it might work, but only via Connection public 
API in scheduler, not interactive session as you do.

The interactive session behaviour you described was never a Public interface of 
Airflow.

You have not described how you start your interactive shell and what stacktrace 
you get, but generally speaking I think we've never thought about using it this 
way. If you describe it in detail in a feature request (i.e. allowing to do 
stuff interactively - with exact proposal on how you would like to intereact 
with  airflow)  - I guess we might consider it and turn it into "actual public 
API" of airflow and we could make it work in specific circumstances. But it 
should start with describing a general feature for it, what you would like to 
do, typical operations you think should work etc. 

Also this might still change in Airflow 3.2 -> we are workign on completing 
task isolation and when it is done, you will have limited access to Airflow 
packages on worker and no task-sdk on scheduler, so behaviour of it might still 
change.

One of the things with Airflow 2 and the way you use it that people (like you) 
used some bits of pieces of Airlfow in their own ways and while it worked 
"accidentally" - it was never part of the public interface of Airflow. This 
changed in Airflow 3 where a lot of architectural changes made some things to 
stop working - and the right way of fixing it is to listen to our users, see 
how they want to use airflow and implement something they can use in a form of 
maintainable, publc interface.

So if you would like to describe a more complete use case of "interactive use 
fo some of the airflow components" or similar - that is a good start to have it 
implemented.

GitHub link: 
https://github.com/apache/airflow/discussions/60334#discussioncomment-15506937

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to