From ee87fa0cba4d83084b4bc617d63d117101d9e069 Mon Sep 17 00:00:00 2001 From: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Date: Fri, 20 Sep 2024 11:10:29 -0600 Subject: [PATCH] Minor fixups to FAB DB command docs (#42377) --- contributing-docs/13_metadata_database_updates.rst | 14 +++++++------- .../migrations-ref.rst | 9 ++------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/contributing-docs/13_metadata_database_updates.rst b/contributing-docs/13_metadata_database_updates.rst index e7ff6428d8cd..da986ef24f8c 100644 --- a/contributing-docs/13_metadata_database_updates.rst +++ b/contributing-docs/13_metadata_database_updates.rst @@ -58,12 +58,12 @@ This guide will show you how to hook your application into Airflow's migration p Subclass the BaseDBManager ========================== -To hook your application into Airflow's migration process, you need to subclass the BaseDBManager class from the -airflow.utils.db_manager.py module. This class provides methods for running Alembic migrations. +To hook your application into Airflow's migration process, you need to subclass the ``BaseDBManager`` class from the +``airflow.utils.db_manager`` module. This class provides methods for running Alembic migrations. Create Alembic migration scripts ================================ -At the root of your application, run "alembic init migrations" to create a new migrations directory. Set +At the root of your application, run "alembic init migrations" to create a new migrations directory. Set the ``version_table`` variable in the ``env.py`` file to the name of the table that stores the migration history. Specify this version_table in the ``version_table`` argument of the alembic's ``context.configure`` method of the ``run_migration_online`` and ``run_migration_offline`` functions. This will ensure that your application's migrations are stored in a separate @@ -74,10 +74,10 @@ migrations. This too should be specified in the ``context.configure`` method of Next, set the config_file not to disable existing loggers: -```python -if config.config_file_name is not None: - fileConfig(config.config_file_name, disable_existing_loggers=False) -``` +.. code-block:: python + + if config.config_file_name is not None: + fileConfig(config.config_file_name, disable_existing_loggers=False) Replace the content of your application's ``alembic.ini`` file with Airflow's ``alembic.ini`` copy. diff --git a/docs/apache-airflow-providers-fab/migrations-ref.rst b/docs/apache-airflow-providers-fab/migrations-ref.rst index 49c6df64e0b9..dbddd6e7d413 100644 --- a/docs/apache-airflow-providers-fab/migrations-ref.rst +++ b/docs/apache-airflow-providers-fab/migrations-ref.rst @@ -23,14 +23,9 @@ Here's the list of all the Database Migrations that are executed via when you ru .. warning:: Those migration details are mostly used here to make the users aware when and what kind of migrations - will be executed during migrations between specific Airflow versions. The intention here is that the + will be executed during migrations between specific FAB provider versions. The intention here is that the "DB conscious" users might perform an analysis on the migrations and draw conclusions about the impact - of the migrations on their Airflow database. Those users might also want to take a look at the - :doc:`apache-airflow:database-erd-ref` document to understand how the internal DB of Airflow structure looks like. - However, you should be aware that the structure is internal and you should not access the DB directly - to retrieve or modify any data - you should use the :doc:`REST API ` to do that instead. - - + of the migrations on their Airflow database. .. This table is automatically updated by pre-commit by ``scripts/ci/pre_commit/migration_reference.py`` .. All table elements are scraped from migration files