bujjibabukatta opened a new pull request, #71673: URL: https://github.com/apache/airflow/pull/71673
## Summary Fixes createUserJob (and other FAB CLI/API user & role management commands) failing to connect to the database when a custom `create_metadata_engine` is defined in `airflow_local_settings.py` (e.g. for IAM/token-based DB auth). ## Root cause `get_application_builder()` created its own Flask-SQLAlchemy engine directly from `SQLALCHEMY_DATABASE_URI`, bypassing `airflow.settings.create_metadata_engine`. So any custom engine-creation logic in `airflow_local_settings.py` was silently ignored for this engine, even though it works correctly for Airflow's main metadata engine. ## Fix Added an `_AirflowFlaskSQLAlchemy` subclass that overrides `_make_engine` to build the engine via `airflow.settings.create_metadata_engine`, so it now honors the same override as the rest of Airflow. Closes: #71664 Was generative AI tooling used ? - [X] Yes - Claude Generated-by: Claude following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
