bugraoz93 commented on code in PR #45255:
URL: https://github.com/apache/airflow/pull/45255#discussion_r1898741028
##########
providers/src/airflow/providers/fab/auth_manager/cli_commands/db_command.py:
##########
@@ -17,12 +17,26 @@
from __future__ import annotations
from airflow import settings
-from airflow.cli.commands.local_commands.db_command import
run_db_downgrade_command, run_db_migrate_command
from airflow.providers.fab.auth_manager.models.db import _REVISION_HEADS_MAP,
FABDBManager
+from airflow.providers.fab.version_compat import AIRFLOW_V_3_0_PLUS
from airflow.utils import cli as cli_utils
from airflow.utils.providers_configuration_loader import
providers_configuration_loaded
+def get_db_command():
+ try:
+ if AIRFLOW_V_3_0_PLUS:
+ import airflow.cli.commands.local_commands.db_command as db_command
+ else:
+ import airflow.cli.commands.db_command as db_command
+ except ImportError:
+ from airflow.exceptions import AirflowOptionalProviderFeatureException
+
+ raise AirflowOptionalProviderFeatureException("Failed to import
db_command from Airflow CLI.")
Review Comment:
Oo I thought I should wrap it to try/catch to make `mypy` happy but without
it, it is working fine too. Though I couldn't eliminate the method if I placed
the imports to root, `mypy` got angry.
--
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]