This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new e0bbf51870f Move "create db from orm" to be a public method in db 
manager interface (#48000)
e0bbf51870f is described below

commit e0bbf51870f08148596c06b4699529e34d13c21c
Author: Pratiksha <[email protected]>
AuthorDate: Fri Mar 21 13:39:42 2025 +0530

    Move "create db from orm" to be a public method in db manager interface 
(#48000)
    
    * moving create_db_orm to be a public method in db manager
    
    * move create_db_from_orm to be a public method in fab provider
    
    * Update providers/fab/src/airflow/providers/fab/auth_manager/models/db.py
    
    ---------
    
    Co-authored-by: Vincent <[email protected]>
---
 airflow/utils/db_manager.py                                       | 4 ++--
 providers/fab/src/airflow/providers/fab/auth_manager/models/db.py | 4 ++--
 tests/utils/test_db_manager.py                                    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/airflow/utils/db_manager.py b/airflow/utils/db_manager.py
index bc91f3c8003..46c4323dde5 100644
--- a/airflow/utils/db_manager.py
+++ b/airflow/utils/db_manager.py
@@ -86,7 +86,7 @@ class BaseDBManager(LoggingMixin):
             return True
         return False
 
-    def _create_db_from_orm(self):
+    def create_db_from_orm(self):
         """Create database from ORM."""
         self.log.info("Creating %s tables from the ORM", 
self.__class__.__name__)
         engine = self.session.get_bind().engine
@@ -118,7 +118,7 @@ class BaseDBManager(LoggingMixin):
         if db_exists:
             self.upgradedb()
         else:
-            self._create_db_from_orm()
+            self.create_db_from_orm()
 
     def upgradedb(self, to_revision=None, from_revision=None, 
show_sql_only=False):
         """Upgrade the database."""
diff --git a/providers/fab/src/airflow/providers/fab/auth_manager/models/db.py 
b/providers/fab/src/airflow/providers/fab/auth_manager/models/db.py
index 5e2c5397745..8ffb6cfeab8 100644
--- a/providers/fab/src/airflow/providers/fab/auth_manager/models/db.py
+++ b/providers/fab/src/airflow/providers/fab/auth_manager/models/db.py
@@ -54,8 +54,8 @@ class FABDBManager(BaseDBManager):
     alembic_file = (PACKAGE_DIR / "alembic.ini").as_posix()
     supports_table_dropping = True
 
-    def _create_db_from_orm(self):
-        super()._create_db_from_orm()
+    def create_db_from_orm(self):
+        super().create_db_from_orm()
         _get_flask_db(settings.SQL_ALCHEMY_CONN).create_all()
 
     def upgradedb(self, to_revision=None, from_revision=None, 
show_sql_only=False):
diff --git a/tests/utils/test_db_manager.py b/tests/utils/test_db_manager.py
index b44262961f8..34f849bf2e0 100644
--- a/tests/utils/test_db_manager.py
+++ b/tests/utils/test_db_manager.py
@@ -113,7 +113,7 @@ class MockDBManager(BaseDBManager):
 class TestBaseDBManager:
     @mock.patch.object(BaseDBManager, "get_alembic_config")
     @mock.patch.object(BaseDBManager, "get_current_revision")
-    @mock.patch.object(BaseDBManager, "_create_db_from_orm")
+    @mock.patch.object(BaseDBManager, "create_db_from_orm")
     def test_create_db_from_orm_called_from_init(
         self, mock_create_db_from_orm, mock_current_revision, mock_config, 
session
     ):

Reply via email to