Skip to content

Commit

Permalink
Minor fixups to FAB DB command docs (apache#42377)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedcunningham authored Sep 20, 2024
1 parent 4d7fad3 commit ee87fa0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
14 changes: 7 additions & 7 deletions contributing-docs/13_metadata_database_updates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down
9 changes: 2 additions & 7 deletions docs/apache-airflow-providers-fab/migrations-ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stable-rest-api-ref>` 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
Expand Down

0 comments on commit ee87fa0

Please sign in to comment.